Hi
I am trying to apply multiple resize operation on image uploaded through web page.
I have a JPG image uploaded from a web page in my memory blob.
Before performing multiple resize operations on the image i want to convert the JPG to MPC and then want to create new resized jpg images from the MPC image.
But i am having very hard time to convert the image from .jpg to .mpc using c or c++ API.
It is the most basic operation of the convert command in IM.
Is there any API that can be used to perform the basic conversion operation?
Thanks
Shalin.
Image format conversion API
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Image format conversion API
Still having problems?
convert t.jpg t.mpc
Works for me, note that "t.mpc" also creates a "t.cache" file which does with it.
The file is also only usable on the machine that created it as it is OS and archeteture dependant, but is also an instant read as it is a direct memory type access.
convert t.jpg t.mpc
Works for me, note that "t.mpc" also creates a "t.cache" file which does with it.
The file is also only usable on the machine that created it as it is OS and archeteture dependant, but is also an instant read as it is a direct memory type access.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Image format conversion API
Hi Anthony,
Thanks for your reply. I can use conversion using command line utility provided.
But i am using the software in a web application and have to use conversion using C or C++ API of core imagemagick code. So, please let me know if you have any idea on how to convert image using any imagemagick API.
Thanks
Shalin.
Thanks for your reply. I can use conversion using command line utility provided.
But i am using the software in a web application and have to use conversion using C or C++ API of core imagemagick code. So, please let me know if you have any idea on how to convert image using any imagemagick API.
Thanks
Shalin.
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Image format conversion API
Here's a function in C which uses MagickWand to do the conversion:
Pete
Code: Select all
#include <windows.h>
#include <wand/magick_wand.h>
void test_wand(void)
{
MagickWand *m_wand = NULL;
MagickWandGenesis();
/* Create a wand */
m_wand = NewMagickWand();
/* Read the input image */
if(!MagickReadImage(m_wand,"t.jpg")) {
MessageBox(NULL,"Failed to read input file","",MB_OK);
} else {
/* and write it in a different format */
MagickWriteImage(m_wand,"t.mpc");
}
/* Tidy up */
m_wand = DestroyMagickWand(m_wand);
MagickWandTerminus();
}