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.
How do I read an image from file scanline by scanline?
- 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?
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.
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.
-
- 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?
IM contains a progress monitoring system. Eg:
... will show the progress of the load and resize. Perhaps you can hook into this.
Code: Select all
convert very_large.tiff -resize 10% out.png
snibgo's IM pages: im.snibgo.com
-
- 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?
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.
-
- 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?
Oh, of course the MagickCore::SetImageInfoProgressMonitor function is solving my issue.
Thanks snibgo, fmw42!
Thanks snibgo, fmw42!