Can i save image in memory and not in disk using C API ?

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
umen
Posts: 12
Joined: 2012-06-27T06:49:24-07:00
Authentication code: 13

Can i save image in memory and not in disk using C API ?

Post by umen »

Hello all
i have this command line :

Code: Select all

\ImageMagick-7.0.8-Q16\magick.exe -background transparent -fill white -font Amiri-Bold -pointsize 100 -kerning 5.0 -gravity center label:@c:\users\foo\appdata\local\temp\tmpahpcw2.txt -type truecolormatte PNG32:c:\users\foo\appdata\local\temp\tmp1ogyjm.png
as you see it takes the string from file and save it to png file .
my question is can i do the same operation using the C API ( i guess yes ) but the important issue is not using files on disk only in memory .
Thanks for helping
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Can i save image in memory and not in disk using C API ?

Post by snibgo »

Yes, your command can be done with the C API. The magick.exe program uses the C API, so any magick command can be written as a C program that uses the C API.

I don't understand "but the important issue is not using files on disk only in memory". If your file system can store files in memory, say drive "M:", then that's fine. But that is a feature of the file system, not ImageMagick.
snibgo's IM pages: im.snibgo.com
umen
Posts: 12
Joined: 2012-06-27T06:49:24-07:00
Authentication code: 13

Re: Can i save image in memory and not in disk using C API ?

Post by umen »

thanks for the fast replay , so if i like to see what imagemagik is doing i need to check the convert.c file ?
and just follow the path ?
also i was planning to use the c++ API aka Magick++ , is it the same as the C API i mean has all the options ?

the memory part what i meant is to do all opertion in memory , i think in the Magick++ is called "Blob"
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Can i save image in memory and not in disk using C API ?

Post by snibgo »

Yes, you can read the source code and find the functions you need.

I know the C API fairly well, but don't know the C++ API as well. The IM programs use the C API, not the C++ API, so there may be C operations that have accidentally been omitted from the C++ API. If so, report this as a bug.

When IM reads an image, it then has a copy of that image in memory. You can then do whatever you want with that image in memory, and save it to a file system (which might be a thumbdrive or memory card), or write it to a pipe or whatever.

But you ask about saving the image to (volatile?) memory. When a program writes to volatile memory, that data vanishes when the program finishes. So I don't understand what you mean by "save image in memory".

Why do you want to write C (or C++) programs? What advantage will that have over using the command line?
snibgo's IM pages: im.snibgo.com
umen
Posts: 12
Joined: 2012-06-27T06:49:24-07:00
Authentication code: 13

Re: Can i save image in memory and not in disk using C API ?

Post by umen »

thanks for your answer , this image in memory will be handled by other app.
another question if i may ..
do you recommend me to use the C API directly from C++ app?
are they more updated ?
Post Reply