TBitmap from MagickWand in FreePascal/Delphi

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
Posts: 1
Joined: 2011-04-17T04:10:05-07:00
Authentication code: 8675308

TBitmap from MagickWand in FreePascal/Delphi

Post by pascalino » 2011-04-17T04:18:39-07:00

How could I build a TBitmap from an image file, using MagicWand api? I have problems retrieving the palette from the loaded file. It seems to me it has to be recalculated from loaded pixel data (??) using ColorMap functions, which sounds like a bit loss of efficiency.

And another question about efficiency. Think about this example: A software generates a 1000x1000 pixel bitmap, with 4bit depth. We may think that the developer had good reasons to choose that 4bit format and not another.

I've read in docs that IM converts every loaded image, like the one in the example, it to an internal format in order to make it suitable to operate with it.

If i'm right (please tell me if not), I think that silently converting images to other temporal and supposed "better" format can lend to waste of memory and performance. I've also read that IM tries to avoid this issue letting you to save the image in this temporal format, so you can load it later skipping the internal conversion process. But this is a non-standard format and needs much space, typical of raw data.

IMHO, IM should give an option to skip the internal conversion and store the pixels in memory in the most similar way as they were in the file. For example, a JPEG image will be just decompressed and you'll receive simple raw RGB data. You may say this format is not suitable to use with the powerful set of IM routines, that were designed to operate in the generic internal format. My 1000x1000x4 bitmap is a 16 state finite machine, it will not require beautiful color and edge enhancing routines, so it never should be converted to any generic format.

Is there eny option to avoid internal format conversion, and keeping the native pixels and palette in memory as is (I think libraries like LeadTools work this way), knowing that this way we lose access to IM processing library?


Post Reply