The code below demonstrates the problem. This happens with ImageEn 10.3.5
You can load a JPEG file in ImageEnViewOriginal, when you save this file in a new name with
ImageEnViewOriginal.IO.Params.JPEG_ColorSpace := ioJPEG_RGB;
and you load this file in the other ImageEnViewCopy, the red and blue are converted.
Is this a bug? Or can we work around it. We are planning to upgrade our ImageEN components but this is a show stopper for us.
unit uFormMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.ComCtrls, hyiedefs,
hyieutils, iexBitmaps, iesettings, iexLayers, iexRulers, iexToolbars,
iexUserInteractions, imageenio, imageenproc, ieview, imageenview, Vcl.ExtDlgs,
Vcl.StdCtrls;
type
TFormMain = class(TForm)
PanelLeft: TPanel;
StatusBar1: TStatusBar;
Splitter1: TSplitter;
PanelClient: TPanel;
PanelLeftTop: TPanel;
PanelClientTop: TPanel;
ImageEnViewOriginal: TImageEnView;
ImageEnViewCopy: TImageEnView;
OpenPictureDialog: TOpenPictureDialog;
ButtonLoad: TButton;
ButtonSaveAsAndLoad: TButton;
procedure ButtonLoadClick(Sender: TObject);
procedure ButtonSaveAsAndLoadClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormMain: TFormMain;
implementation
{$R *.dfm}
procedure TFormMain.ButtonLoadClick(Sender: TObject);
begin
if OpenPictureDialog.Execute then
begin
ImageEnViewOriginal.IO.LoadFromFile(OpenPictureDialog.FileName);
ButtonSaveAsAndLoad.Enabled := True;
end;
end;
procedure TFormMain.ButtonSaveAsAndLoadClick(Sender: TObject);
var
folder,
uniqueName,
extension,
newFileName: string;
begin
folder := ExtractFilePath(OpenPictureDialog.FileName);
uniqueName := TGuid.NewGuid.ToString();
extension := ExtractFileExt(OpenPictureDialog.FileName);
newFileName := folder + uniqueName + extension;
ImageEnViewOriginal.IO.Params.JPEG_ColorSpace := ioJPEG_RGB; // this causes the invert of red and blue while loading
ImageEnViewOriginal.IO.SaveToFileJpeg(newFileName);
ImageEnViewCopy.IO.LoadFromFileJpeg(newFileName);
end;
end.