pyvips icon indicating copy to clipboard operation
pyvips copied to clipboard

What is the parallel of magick autolevel in pyvips?

Open deepankarpal1985 opened this issue 6 years ago • 5 comments

What is the parallel of magick autolevel in pyvips?

deepankarpal1985 avatar Jul 10 '19 16:07 deepankarpal1985

Try image.scaleimage().

https://libvips.github.io/pyvips/vimage.html#pyvips.Image.scaleimage

Main docs:

https://jcupitt.github.io/libvips/API/current/libvips-conversion.html#vips-scale

jcupitt avatar Jul 10 '19 16:07 jcupitt

Tried that, can't write to a png file post that

unable to call VipsForeignSavePngFile vipspng: out of order read at line 240 vips2png: unable to write "t2.png"


From: John Cupitt [email protected] Sent: Wednesday, July 10, 2019 10:50 AM To: libvips/pyvips Cc: Deepankar Pal; Author Subject: Re: [libvips/pyvips] What is the parallel of magick autolevel in pyvips? (#108)

Try image.scaleimage().

https://libvips.github.io/pyvips/vimage.html#pyvips.Image.scaleimage

Main docs:

https://jcupitt.github.io/libvips/API/current/libvips-conversion.html#vips-scale

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/libvips/pyvips/issues/108?email_source=notifications&email_token=AKCMAWBJWFHJWUBBBKKW7MTP6YHMFA5CNFSM4H7RGH72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZUCJJI#issuecomment-510141605, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKCMAWGESWPSPNPR2DQTNJLP6YHMFANCNFSM4H7RGH7Q.

deepankarpal1985 avatar Jul 10 '19 16:07 deepankarpal1985

You've opened your image in sequential mode. Remove the access= from the new_from_file.

jcupitt avatar Jul 10 '19 17:07 jcupitt

... to explain, scale has to scan the image to find the min and max before it can scale the image levels. But if the image has been opened in streaming mode, you can only read each pixel once. So when the save to PNG operation starts, the image has already been scanned and there are no pixels left.

jcupitt avatar Jul 10 '19 17:07 jcupitt

Thanks


From: John Cupitt [email protected] Sent: Wednesday, July 10, 2019 11:06 AM To: libvips/pyvips Cc: Deepankar Pal; Author Subject: Re: [libvips/pyvips] What is the parallel of magick autolevel in pyvips? (#108)

... to explain, scale has to scan the image to find the min and max before it can scale the image levels. But if the image has been opened in streaming mode, you can only read each pixel once. So when the save to PNG operation starts, the image has already been scanned and there are no pixels left.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/libvips/pyvips/issues/108?email_source=notifications&email_token=AKCMAWGSD6EJKTFYAF2F42TP6YJKRA5CNFSM4H7RGH72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZUDXRA#issuecomment-510147524, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKCMAWGFMANPBNYNY3KL2QTP6YJKRANCNFSM4H7RGH7Q.

deepankarpal1985 avatar Jul 10 '19 17:07 deepankarpal1985