Serializing Image Class [SOLVED]

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
insomniacp
Posts: 11
Joined: 2012-08-20T09:03:33-07:00
Authentication code: 67789

Serializing Image Class [SOLVED]

Post by insomniacp » 2012-08-21T08:19:51-07:00

Hi,
I am working on a program that has a large number of base images and it then dynamically generates images on top of those images. The base images are 1900x1900 png files and I have found that it takes about 250ms to load them into imagemagick and only about 10ms to read from the disk. Because of this extra time I am wondering if there is a way to serialize the Image class so that I can write it to a file and load it at a faster rate than trying to load a png file. I have already implemented writing to a character string of RGBA data and putting that in a file for future use and that reduces load time to about 80ms on average when reading from a memory based partition. Due to the large number of images I cannot keep them all in memory but reading from the hard disk does not seem to be the slow point in the process since it reads the entire file into a Blob takes 10ms but reading the Blob into an Image takes 200ms. Ideally I would serialize the entire class so that it can quickly load from disk without having to reparse an image file but I do not see any way to do that. Is there something similar to this already available or will I have to code it myself? I do need alpha/opacity channels so I cannot save to a format without support for that.

I compiled ImageMagick-6.7.8-10 from source.
Last edited by insomniacp on 2012-08-22T10:50:40-07:00, edited 1 time in total.

User avatar
magick
Site Admin
Posts: 11042
Joined: 2003-05-31T11:32:55-07:00

Re: Serializing Image Class

Post by magick » 2012-08-21T08:53:42-07:00

You can write your images in the MPC format. The MPC format loads quickly because its in the ImageMagick native format and is memory-mapped for fast load times.

insomniacp
Posts: 11
Joined: 2012-08-20T09:03:33-07:00
Authentication code: 67789

Re: Serializing Image Class [SOLVED]

Post by insomniacp » 2012-08-22T10:51:05-07:00

Exactly what i was looking for thank you.

Post Reply