How do I read an image from file scanline by scanline?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
wizard29
Posts: 58
Joined: 2014-03-21T00:40:16-07:00
Authentication code: 6789
Location: Russia, Saint Petersburg
Contact:

How do I read an image from file scanline by scanline?

Post by wizard29 »

Hello everyone!
I need to show an image loading progress.
How do I read an image from file scanline by scanline?
I use the Magick++ API.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I read an image from file scanline by scanline?

Post by fmw42 »

I think you will likely need to create an animation where for the first frame you just read the first line of the image and put it into a transparent background the size of the full image. Then the next frame you read the first 2 lines and put that into a transparent background. Etc. Then convert all the resulting images into a gif animation. This can be done by writing a loop in a script.

see
http://www.imagemagick.org/script/comma ... essing.php (selecting a region)
http://www.imagemagick.org/Usage/compose/#compose
http://www.imagemagick.org/Usage/anim_basics/


You could also do it by reading the first line as above. Then for the second frame, read just the second line and composite over the first frame to make the second frame, etc until you reach the last line. This would likely be easier and perhaps faster.

Sorry I do not know the Magick++ API, only the command line and shell scripting.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How do I read an image from file scanline by scanline?

Post by snibgo »

IM contains a progress monitoring system. Eg:

Code: Select all

convert very_large.tiff -resize 10% out.png
... will show the progress of the load and resize. Perhaps you can hook into this.
snibgo's IM pages: im.snibgo.com
wizard29
Posts: 58
Joined: 2014-03-21T00:40:16-07:00
Authentication code: 6789
Location: Russia, Saint Petersburg
Contact:

Re: How do I read an image from file scanline by scanline?

Post by wizard29 »

I found the MagickCore::SetImageProgressMonitor function that give an access to progress monitoring. But I don't understand how I can use this method when I use the Magick::Image.
wizard29
Posts: 58
Joined: 2014-03-21T00:40:16-07:00
Authentication code: 6789
Location: Russia, Saint Petersburg
Contact:

Re: How do I read an image from file scanline by scanline?

Post by wizard29 »

Oh, of course the MagickCore::SetImageInfoProgressMonitor function is solving my issue.
Thanks snibgo, fmw42!
Post Reply