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
 Image getting saved in Grayscale Why?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
727 Posts

Posted - Jul 12 2016 :  11:27:40  Show Profile  Reply
Hello,

I am using following code to Load images in TImageEnVect on different layers and then merging them all and saving the image as JPG. Here is the code:

// Create a New Doc
ImageEnVect.Blank;
ImageEnVect.ClearAll;
ImageEnVect.Proc.Clear;
ImageEnVect.RemoveAllObjects;

ievMain.Proc.ImageResize(2400, 1200, iehLeft, ievTop);
ImageEnVect.Proc.Fill(clWhite);
ImageEnVect.IO.Params.Dpi := 100;
ImageEnVect.ChangeResolution(100, rfBicubic);
ImageEnVect.Layers[0].Locked := True;
ImageEnVect.Layers[0].Selectable := False;
ImageEnVect.Update;

//Code to Load Images on Layers
FileName := 'F001.jpg';
//Load image in a Temp instance
ieTemp := TImageEnView.Create(Application);
ieTemp.IO.Params.JPEG_EnableAdjustOrientation := True;
ieTemp.LayersAdd;
ieTemp.IO.LoadFromFile('001.jpg');

ieTemp.Proc.Resample(-1, 800, TResampleFilter(4))

LayerCurr := ImageEnVect.LayersAdd;
ImageEnVect.Layers[LayerCurr].Assign(ieTemp.CurrentLayer);
ImageEnVect.Layers[LayerCurr].PosX := 0;
ImageEnVect.Layers[LayerCurr].PosY := 0;
ImageEnVect.Layers[LayerCurr].Name := '001.jpg';

//Add Mask Layer
ImageEnVect.LayersAdd;
ImageEnVect.CurrentLayer.Assign(ievMain.Layers[LayerCurr]);
ImageEnVect.CurrentLayer.Bitmap.PixelFormat := ie8g;
ImageEnVect.Proc.Fill(clwhite);
ImageEnVect.CurrentLayer.Width := 550;
ImageEnVect.CurrentLayer.Height := 800;
ImageEnVect.CurrentLayer.Visible := True;
ImageEnVect.CurrentLayer.IsMask := True;
ImageEnVect.CurrentLayer.Visible := False;

//Load Another File
ieTemp.IO.LoadFromFile('002.jpg');

ieTemp.Proc.Resample(-1, 800, TResampleFilter(4))

LayerCurr := ImageEnVect.LayersAdd;
ImageEnVect.Layers[LayerCurr].Assign(ieTemp.CurrentLayer);
ImageEnVect.Layers[LayerCurr].PosX := 600;
ImageEnVect.Layers[LayerCurr].PosY := 20;
ImageEnVect.Layers[LayerCurr].Name := '002.jpg';

//Add Mask Layer
ImageEnVect.LayersAdd;
ImageEnVect.CurrentLayer.Assign(ievMain.Layers[LayerCurr]);
ImageEnVect.CurrentLayer.Bitmap.PixelFormat := ie8g;
ImageEnVect.Proc.Fill(clwhite);
ImageEnVect.CurrentLayer.Width := 550;
ImageEnVect.CurrentLayer.Height := 800;
ImageEnVect.CurrentLayer.Visible := True;
ImageEnVect.CurrentLayer.IsMask := True;
ImageEnVect.CurrentLayer.Visible := False;


ieTemp.Free;


//Save File using SaveAll
ImageEnVect.SaveToFileAll('MyFileSample.iev', ioPNG);

//Create a JPG thumbnail for viewing in Win Explorer
ImageEnVect.LayersCurrent := 0;

ImageEnVect.Proc.AutoUndo := False;
ImageEnVect.Proc.SaveUndo();
ImageEnVect.LayersMergeAll();

ImageEnVect.Proc.Resample(300, -1, TResampleFilter(rfBSpline));
ImageEnVect.IO.SaveToFileJpeg('MyFileSample.jpg');
ImageEnVect.Proc.Undo(False);  //Does not seem to work I don't know as why
ImageEnVect.Proc.AutoUndo := True;


The code is straight forward but the jpg is getting saved as grayscale.

Why?

TIA


Yogi Yang

xequte

38615 Posts

Posted - Jul 18 2016 :  20:01:45  Show Profile  Reply
Hi Yogi

I cannot reproduce that. Can you email me your source files?



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

yogiyang

India
727 Posts

Posted - Jul 19 2016 :  11:17:49  Show Profile  Reply
Source files sent through www.wetransfer.com.

TIA


Yogi Yang
Go to Top of Page

yogiyang

India
727 Posts

Posted - Jul 22 2016 :  00:23:20  Show Profile  Reply
Hello Nigel,

Did you receive the download link in you mail box?

Did you manage to download the code sample?

TIA


Yogi Yang
Go to Top of Page

xequte

38615 Posts

Posted - Jul 24 2016 :  04:30:49  Show Profile  Reply
Hi

I'm afraid you have sent an entire application. Is not practical for us to try and debug that. Please create a very simple demo that shows the issue.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: