ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 LayersSaveMergedTo is saving invalid ICC profile
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
730 Posts

Posted - Dec 02 2017 :  02:43:46  Show Profile  Reply
Hello,

I am loading a PDF file which is set to CMYK mode.

In this I am loading a few layers from other photo/images.

Some of the images are in RGB mode and some are in CMYK mode.

I am using LayersSaveMergedTo to save the file to JPG with all layers merged.

This file when opened in Photoshop it give the message as shown in the screen shot:




TIA



Yogi Yang

yogiyang

India
730 Posts

Posted - Dec 04 2017 :  09:24:09  Show Profile  Reply
Hello,

On further investigation I found that this code works well but gives error when we try to save the file:

procedure TfrmMain.Button1Click(Sender: TObject);
var
  ieMain: TImageEnView;
begin
  ieMain := TImageEnView.Create(nil);
  
  ieMain.LegacyBitmap := False;
  IEGlobalSettings().EnableCMS := True;
  IEGlobalSettings().ApplyColorProfileOnRendering := True;
  ieMain.IO.NativePixelFormat := True;

  ieMain.IO.Params.PSD_LoadLayers := True;
  ieMain.IO.Params.PSD_ReplaceLayers := True;

  ieMain.IO.LoadFromFilePSD('Double01Y.dat');

  ieMain.LayersCurrent := 1;

  ieMain.IO.LoadFromFileJpeg('001_9x12 (portrait).jpg');

  ieMain.LayersCurrent := 8;

  ieMain.IO.LoadFromFileJpeg('002_9x12 (portrait).jpg');

  ieMain.LayersSaveMergedTo('Test001.jpg');

  ieMain.Free;
end;


You can download the sample files for testing from here: https://www.dropbox.com/s/b65ba8c3936oant/TestCase.zip?dl=0

TIA



Yogi Yang
Go to Top of Page

yogiyang

India
730 Posts

Posted - Dec 05 2017 :  07:24:30  Show Profile  Reply
On further experimentation I change the last line of code which was giving error from
ieMain.LayersSaveMergedTo('Test001.jpg');

to these

ieMain.LayersMergeAll();
ieMain.IO.SaveToFileJpeg('Test001.jpg');

Now things are working find but Photoshop still gives error message about invalid profile.

TIA


Yogi Yang
Go to Top of Page

yogiyang

India
730 Posts

Posted - Dec 05 2017 :  07:29:45  Show Profile  Reply
I was reading the help file to find a solution and I came across this IO Parameter:
TIOParams.JPEG_ColorSpace

I applied this parameter like this to force ImageEn to save the file in required format
ieMain.IO.Params.JPEG_ColorSpace := ioJPEG_CMYK;
ieMain.IO.SaveToFileJpeg('Test001.jpg');


Now I am able to force ImageEn to save to a particular color space. But the problem is if the original image is in RGB and I use above code to set color space to CMYK the saved JPG file, when opened in Photoshop gives Profile error message but applies the CMYK profile to the file and opens it!

TIA


Yogi Yang
Go to Top of Page

yogiyang

India
730 Posts

Posted - Dec 06 2017 :  00:02:34  Show Profile  Reply
Hello,

Another peculiar thing that I observed is that the Photoshop (PSD) file is set to CMYK color mode/space and it is 300 DPI. But if the photos loaded in various layers are of 200 DPI then final resulting JPG saved comes out at 200 DPI. I don't understand as to why.

Any ideas?




Yogi Yang
Go to Top of Page

xequte

39144 Posts

Posted - Dec 07 2017 :  20:59:44  Show Profile  Reply
Hi Yogi

Can you please advise the steps to reproduce the DPI issue?


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

yogiyang

India
730 Posts

Posted - Dec 08 2017 :  02:09:49  Show Profile  Reply
Hello Nigel,

Please put following code in button click event:

var
  ieMain, ieTemp1: TImageEnView;
  Desc1, Desc2: string;
  LayerW, LayerH: Integer;
begin
  Screen.Cursor := crHourGlass;

  ieMain := TImageEnView.Create(nil);
  ieMain.LegacyBitmap := False;

  IEGlobalSettings().EnableCMS := True;
  IEGlobalSettings().ApplyColorProfileOnRendering := True;
  ieMain.IO.NativePixelFormat := True;

  ieMain.IO.Params.PSD_LoadLayers := True;
  ieMain.IO.Params.PSD_ReplaceLayers := True;

  ieMain.IO.Params.JPEG_EnableAdjustOrientation := True;

  ieMain.IO.LoadFromFilePSD
    ('Double01Y.dat'); //This PSD file is 32bit image with layers

  // Remove Layer with Arrow symbols and Text Layers
  ieMain.LayersRemove(10);
  ieMain.LayersRemove(9);
  ieMain.LayersRemove(3);
  ieMain.LayersRemove(2);

  ieMain.LayersCurrent := 1;

  LayerW := ieMain.CurrentLayer.Width;
  LayerH := ieMain.CurrentLayer.Height;

  //Load the JPG files with different resolution and color space and profile
  ieMain.IO.LoadFromFileJpeg('0000_1.jpg');
  ieMain.CurrentLayer.Width := LayerW;
  ieMain.CurrentLayer.Height := LayerH;

  ieMain.LayersCurrent := 6;

  LayerW := ieMain.CurrentLayer.Width;
  LayerH := ieMain.CurrentLayer.Height;

  ieMain.IO.LoadFromFileJpeg('0001_1.jpg');
  ieMain.CurrentLayer.Width := LayerW;
  ieMain.CurrentLayer.Height := LayerH;

  
  ieMain.LayersMergeAll();
  ieMain.IO.Params.JPEG_Quality := 90;
  ieMain.IO.Params.JPEG_ColorSpace := ioJPEG_CMYK;
  ieMain.IEBitmap.ColorProfile.Assign_CMYKProfile();

  ieMain.IO.SaveToFileJpeg('Test001.jpg');
 
  ieMain.Free;

  Screen.Cursor := crDefault;



For the other files please download from my second post.

Please use attached sample image files.

attach/yogiyang/201712815932_SampleImages.zip
4770.49 KB


Note: The .psd file is of 300 DPI and its profile and color space are set for CMYK

The file 0000_1.jpg is a 24 bit image with 72 dpi resolution and the file 0001_1.jpg is a 24 bit image with 200 dpi resolution.

The output file that you will get from above code will come be in 200 dpi resolution. In spite of the fact that the psd file is of 300 dpi.

The file when opened in Photoshop will result in Photoshop showing Profile error message as stated in my first post.

TIA


Yogi Yang
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: