JuanPotato/Legofy

Add ability to adjust resolution

lamby opened this issue · 9 comments

lamby commented

Please add ability to adjust "resolution" of the output image. I don't necessary mean the output size of the brick, more that the image size of the output changes to include less or more detail of the original.

Could you explain a bit more? like how lego brick size and amount of bricks would work? Because if I were adding more detail, the bricks would need to become smaller, or you're going to get some huge ram usage from this. At some point when the bricks become smaller and smaller, they don't look that great

I agree, that would be very useful. I converted a 200 MB image of Starry Night by Van Gogh and it's barely recognizable. I converted a painting I actually own and I didn't recognize it.

For a work event the graphic designers actually built legos into famous works and photographed those and ended up with great images. They look a lot like these, but with far more brick pixels - on the order of 80 wide and 60 tall for this painting. I can't share the example with you (because of licensing) but can confirm getting up to ~80 pixels per side makes a really gorgeous image.

OK, once I implement it, the bricks will not be that good of quality, but later it might

lamby commented

I think we are talking about two separate options here.

First, at least because it's more simple to describe (!), an option to set the brick size. ie. change the definition of what our "pixel" is. The resulting images would be a multiple of this brick size by definition.

Second, an option to set the "scaling" or "resolution" - whilst my source image might be 600x600, I want the final image size to be much larger in order to "capture" more details of the original. Putting it another way, "legofying" an image is obviously information-destructive, and this would be the setting that controls how much information is in the final image. I believe this is what @carschar was referring to when he made Lego out of Van Gogh.

Perhaps we don't need the brick size option - as you imply, it would not necessarily result in a good image as the brick PNG is somewhat "pixellated" and these images never look good when resized from their designed dimensions.. I mostly just mention it here for completeness and to ensure we are are on the same page.

Ok, working on this, fixed ram usage. this 7680x7680 (baseImage: 256x256) image was made using a consistant 235MB of ram. Usually it would have increased every time a lego block was drawn, but I fixed that. Expect some updates soon.

That is really cool! 👍

forgot to close this, 25f5c88

lamby commented

beautiful