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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 LayersSaveMergedTo is saving invalid ICC profile

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
yogiyang Posted - Dec 02 2017 : 02:43:46
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
6   L A T E S T    R E P L I E S    (Newest First)
yogiyang Posted - Dec 08 2017 : 02:09:49
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
xequte Posted - Dec 07 2017 : 20:59:44
Hi Yogi

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


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
yogiyang Posted - Dec 06 2017 : 00:02:34
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
yogiyang Posted - Dec 05 2017 : 07:29:45
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
yogiyang Posted - Dec 05 2017 : 07:24:30
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
yogiyang Posted - Dec 04 2017 : 09:24:09
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