Page 1 of 1
Profile in dpx format image
Posted: 2009-05-09T08:30:54-07:00
by albertoii
Hi
Sorry for my bad english.
I'm using Magick wand and programming in c.
I need some help, I need to apply an ICC profile to a tiff image and transform it into dpx format. I have achieved my goal but only if the final image is a jpg one, if i change the code and put dpx extension to the final image, I get the image but it doesn't apply the profile.
Can somebody help me??? I can't find the mistake. So, please, if you know how, tell me.
Thank you
Re: Profile in dpx format image
Posted: 2009-05-09T08:41:14-07:00
by magick
Do you want to set a profile or transform the colorspace with a profile? If the latter, did you call MagickProfileImage()? You need to first set the image profile and then call MagickProfileImage() with a profile to use to transform the colorspace.
Re: Profile in dpx format image
Posted: 2009-05-09T09:59:28-07:00
by albertoii
I want to apply an icc profile.
This is what i do:
Code: Select all
magick_wand=NewMagickWand();
status = MagickReadImage(magick_wand, original_file);
MagickResetIterator(magick_wand);
while (MagickNextImage(magick_wand) != MagickFalse){
MagickProfileImage(magick_wand,"ICC",ICC,size);
}
status = MagickWriteImages(magick_wand,destination_file,MagickTrue);
if (status == MagickFalse)
printf("error writting the image");
magick_wand=DestroyMagickWand(magick_wand);
original_file is a file with .tif extension like example.tif
and here is the doubt if destination_file is a file with .jpg extension like example.jpg, it works perfectly but if i change it into .dpx extension like example.dpx the result is the image without the profile applied.
I have also tried with MagickSetImageProfile and it doesn't work too.
I don't why it happens.
Thank you
Re: Profile in dpx format image
Posted: 2009-05-09T18:06:49-07:00
by magick
We'll need to reproduce the problem. Post the shortest script possible that illustrates the problem and a URL to your input image, profile, and output JPEG and DPX images. We need to reproduce the problem before we can offer additional help.
Re: Profile in dpx format image
Posted: 2009-05-10T07:21:08-07:00
by albertoii
I have been looking for other profiles, and finally I realized that the problem was that. I was using a bad ICC profile.
I post my code here anyway:
Code: Select all
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdio.h>
#include <wand/magickwand.h>
int main(int argc, char *argv[])
{
if(argc<3)
{
fprintf(stderr,
"%s original_image destination_image ICC_profile\n",argv[0]);
system("PAUSE");
return -1;
}
///////////////////////////////////////
//Start reading ICC profile
///////////////////////////////////////
size_t size=0;
FILE *file;
int numRead;
unsigned char buffer[2048];
if ((file=fopen(argv[3],"rb"))==NULL){
fprintf(stderr,"Error while opening ICC profile\n");
system("PAUSE");
return -1;
}
else{
while ((numRead = fread(buffer,1,2048,file))){
size+=numRead;
}
}
//This will be variable with the ICC profile
unsigned char ICC[size];
rewind(file);
fread(ICC, 1, size, file);
fclose(file);
//////////////////////////////////////////////
MagickWand *magick_wand;
MagickBooleanType status;
MagickWandGenesis();
magick_wand=NewMagickWand();
status = MagickReadImage(magick_wand, argv[1]);
MagickResetIterator(magick_wand);
if (status == MagickFalse){
fprintf(stderr,"error reading the image\n");
system("PAUSE");
return -1;}
MagickProfileImage(magick_wand,"ICC",ICC,size);
status = MagickWriteImages(magick_wand,argv[2],MagickTrue);
if (status == MagickFalse){
fprintf(stderr,"error writting the image\n");
system("PAUSE");
return -1;}
magick_wand=DestroyMagickWand(magick_wand);
MagickWandTerminus();
system("PAUSE");
return 0;
}
Thank you for all.
Regards