• 0
Lebostein

Get a part image url from a partID and a colorID

Question

6 answers to this question

Recommended Posts

  • 0
Posted (edited)

I need the pictures for my own html export. I have downloaded the "parts.csv", "part_categories.csv" and "colors.csv" from the Rebrickable database and in combination with an exported inventory part list and a small python script I generated my own inventory list in that style:

https://www.dropbox.com/s/m8gp27zx4kbqb6m/tabelle.png?dl=0

At the moment I grab the images from BrickLink, but in this case a colorID conversion is needed and some parts are not available, because there are different partIDs on Rebrickable and Bricklink...

Edited by Lebostein

Share this post


Link to post
Share on other sites
  • 0

Why don't you use the API?

part_num API request (https://rebrickable.com/api/v3/lego/parts/3001/) returns, among other:

 "part_img_url": "https://rebrickable.com/media/parts/elements/300121.jpg",

that ought to give you the best image we currently have,

Of course, you can get those images yourself, in media/parts/elements, media/parts/ldraw, and media/parts/photos; but each of these use different files names (element-ids, ldraw-partnumbers, photo-ids), and for LDraw you also need to know the color-code. As we don't have all different images for every part, you're better of letter the system find the best image. API does that for you.

Take care,
Simon

Share this post


Link to post
Share on other sites
  • 0

Thanks for the API hint. This works in the browser.

Have you a snippet for me to grab the "part_img_url" parameter from a API call like "https://rebrickable.com/api/v3/lego/parts/40490/?key=..." inside a Python script?

Thanks!

Share this post


Link to post
Share on other sites
  • 0

I wish! LOL  Frankly, I had hoped you would figure it out, and I could ask you for an code example.

I never use the API, all my python is really quick and dirty, and when using local downloads, I don't have to worry about performance. But there are several member who do use the API, perhaps they can help you.

ADDED - THX for the link -smile-

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now