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
 WIC Failure when save to JPEG
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

foxdingding

77 Posts

Posted - Mar 03 2022 :  01:44:51  Show Profile  Reply


IEN 10.3
Delphi11
64Bit


procedure TForm3.Button1Click(Sender: TObject);
begin
  ImageEnView2.IO.Params.TIFF_Compression:=TIOTIFFCompression.ioTIFF_LZW;
  ImageEnView2.IO.SaveToFiletiff(sFileName+'_LZW_.tif');
   ShowMessage('Save OK!');
end;

procedure TForm3.Button2Click(Sender: TObject);
begin
  ImageEnView2.IO.Params.TIFF_Compression:=TIOTIFFCompression.ioTIFF_Jpeg;
  ImageEnView2.IO.SaveToFiletiff(sFileName+'_JPEG_.tif');
end;

procedure TForm3.Button3Click(Sender: TObject);
begin
  ImageEnView2.IO.SaveToFileJpeg(sFileName+'.jpg');
end;

procedure TForm3.Button4Click(Sender: TObject);
begin
  ImageEnView2.IO.SaveToFilePNG(sFileName+'.png');
end;


procedure IEJoinBitmaps_1(Dest: TIEBitmap;
                              Src: TIEBitmap;
                              Vertical: Boolean;
                              BGColor: TColor = clBlack);
var
   imgLeft, imgTop: Integer;
   totalWidth,totalHeight:Integer;
   tmpI:Integer;
begin
   if Vertical then//#22402;#30452;#30340;
   begin
      totalWidth :=Src.Width;
      totalHeight:=Src.Height*100;
   end
   Else
   Begin
      totalWidth :=Src.Width*100;
      totalHeight:=Src.Height;
   End;

   if totalWidth<=0 then Exit;
   if totalHeight<=0 then Exit;

   Dest.IEInitialize( totalWidth, totalHeight, BGColor );

   imgTop :=0;
   imgLeft:=0;

   for tmpI := 0  to 99 do
   Begin
     if Vertical then
     begin
       imgLeft := ( totalWidth - Src.Width ) div 2;

       Src.DrawToTIEBitmap( Dest, imgLeft, imgTop );
       Inc(imgTop,Src.Height);
     end
     else
     begin
       imgTop  := ( totalHeight - Src.Height ) div 2;

       Src.DrawToTIEBitmap( Dest, imgLeft, imgTop );
       Inc(imgLeft,Src.Width);
     end;
   End;
end;


procedure TForm3.Button5Click(Sender: TObject);
Var
   tmpIEBitmap:TIEBitmap;
begin
   tmpIEBitmap:=Self.ImageEnView1.IEBitmap;

   tmpIEBitmap.IEInitialize( 10*300, 10*300, clWhite );

   tmpIEBitmap.Canvas.Pen.Color:=clRed;
   tmpIEBitmap.Canvas.Pen.Width:=20;
   tmpIEBitmap.Canvas.LineTo(0,0);
   tmpIEBitmap.Canvas.LineTo( tmpIEBitmap.width,tmpIEBitmap.height);

   tmpIEBitmap.Canvas.Pen.Color:=clGreen;
   tmpIEBitmap.Canvas.Pen.Width:=20;
   tmpIEBitmap.Canvas.LineTo(tmpIEBitmap.width,0);
   tmpIEBitmap.Canvas.LineTo( 0,tmpIEBitmap.height);

   ImageEnView1.Update;
   ImageEnView1.Fit();


   IEJoinBitmaps_1(Self.ImageEnView2.IEBitmap,
                        ImageEnView1.IEBitmap,
                        TRUE,clWhite);

   ImageEnView2.Update;
   ImageEnView2.FitToWidth;

   Self.Caption:=ImageEnView2.IEBitmap_Width.ToString
      +' '+ImageEnView2.IEBitmap_Height.ToString;
end;

procedure TForm3.FormCreate(Sender: TObject);
begin
   sFileName:='C:\123';
end;














attach/foxdingding/20223314747_SaveBug.zip
91.78 KB

xequte

38608 Posts

Posted - Mar 03 2022 :  22:43:16  Show Profile  Reply
Hi

Firstly, please add ielib64.dll to your EXE folder:

https://www.imageen.com/help/ImageEn_DLLs.html

Otherwise it falls back to using WIC for JPEG and PNG handling.


However you may still have some issues saving an image of 3,000 x 300,000. The odd shape with almost a billion mega-pixels seems to trip up the JPEG library.

A more standard shape with over a billion mega-pixels (40,000 x 40,000) works without error.




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