Page 1 of 1
Can i save image in memory and not in disk using C API ?
Posted: 2019-06-28T01:35:28-07:00
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
Re: Can i save image in memory and not in disk using C API ?
Posted: 2019-06-28T04:32:05-07:00
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.
Re: Can i save image in memory and not in disk using C API ?
Posted: 2019-06-28T04:55:00-07:00
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"
Re: Can i save image in memory and not in disk using C API ?
Posted: 2019-06-28T05:38:20-07:00
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?
Re: Can i save image in memory and not in disk using C API ?
Posted: 2019-06-28T08:00:13-07:00
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 ?