TransWikia.com

Image Magick - altering colour levels automatically

Photography Asked by bunnielovekins on February 24, 2021

I’ve been tasked with finding a way to automatically crop and colour adjust product images. The images are on a white-ish background with somewhat inconsistent lighting.

Manually, we’d use photoshop to adjust the levels to force the top-left pixel to be white, which would apply the changes to the whole image. Photoshop can do this automatically.

I’ve just started learning image magick and I’ve got it to automatically crop the images, which has turned out pretty nice. I’ve also done -contrast-stretch 0%x75% which has worked somewhat well to brighten up the image.

I’m wondering if image magick (or something similarly automatable) can do something similar to what photoshop does. What I’ve got now works fairly well, but not as well as what photoshop does. Any ideas?

2 Answers

I actually found this a few days later and forgot to answer my question.

Assuming you're running from a .bat file:

for /f %%i in ('magick %1 -format "%%[pixel:p{10,10}]" info:') do set COLOUR=%%i

Gets the colour of the pixel at 10,10 from the top left.

magick %1 -level-colors black,%COLOUR% %1

Shifts that colour to white.

@hedgie made a good point, but if you're using natural, inconsistent lighting like we are this can provide pretty good results.

Answered by bunnielovekins on February 24, 2021

My doubt is that the appropriate response is - truly, ImageMagick is comparable to for any individual element it offers as an immediate other option.

Different graphical change calculations are basically recorded nowadays and there is each opportunity that you get in open source programming is utilizing similar procedures behind it.

Answered by Zubida on February 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP