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
 Convert image files on the fly?

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
PeterPanino Posted - Mar 28 2014 : 10:07:06
Hi! Is it possible to convert image files like in a Copy action? For example:

ConvertCopyImageFile(source.gif, target.png);

In this case the file source.gif would be copied and converted to target.png. The transparency (if any) would be handled automatically.

Is this possible?
10   L A T E S T    R E P L I E S    (Newest First)
PeterPanino Posted - Mar 31 2014 : 07:51:32
My code from above has a strange behavior: If (and only then) a PNG image was previously loaded in the TImage before the JFIF image then the JFIF is not displayed in the TImage under certain conditions.

So I now load the JFIF with this code and it always works well:

TPicture.RegisterFileFormat('jfif', 'JFIF Image File', TJPEGImage);
ThisJPEGImage := TJPEGImage.Create;
try
  ThisJPEGImage.LoadFromFile('MyImage.jfif');
  timageImage.Picture.Bitmap.Assign(ThisJPEGImage);
finally
  ThisJPEGImage.Free;
end;

(Of course RegisterFileFormat should be executed only once at program start)
w2m Posted - Mar 30 2014 : 13:53:03
Yes, but as far as I can tell, when you save it, the file will not be saved because the file type JFIF is not supported by ImageEnIO.SaveToFile as shown in my previous post.

I have no idea how registering the JFIF file format with TPicture will affect saving the file. It may save... or it may not because JFIF is not a supported ImageEnIO file format.

If you can save the file as JFIF and then reload it after the save please let me know, because this is not documented anywhere that I am aware of.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom ImageEn Development
PeterPanino Posted - Mar 30 2014 : 13:34:41
It seems I was able to load JFIF with this code:
TPicture.RegisterFileFormat('jfif', 'JFIF Image File', TJPEGImage);
ImageEnIO1.LoadFromFileAuto('MyImage.JFIF');
xequte Posted - Mar 30 2014 : 13:03:18
@Bill

Yes, you would need to use a TImageEnMIO to convert a file of multiple frames between formats

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
w2m Posted - Mar 30 2014 : 10:37:27
JFIF files are not supported by ImageEn. JIF files are saved as a jpeg file however:
procedure TImageEnIO.SaveToFile(const FileName: WideString; ImageFormat: TIOFileType = -1);
var
  ex: string;
  fpi: TIEFileFormatInfo;
  fs: TIEWideFileStream;
  Progress: TProgressRec;
begin
  ex := string(IEExtractFileExtW(FileName));
  if FileName = '' then
    exit;
  if (ImageFormat = ioJPEG) or (ex = '.jpg') or (ex = '.jpeg') or (ex = '.jpe') or (ex='.jif') then
    SaveToFileJpeg(FileName)

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom ImageEn Development
PeterPanino Posted - Mar 30 2014 : 09:07:53
Unfortunately ConvertCopyImageFile does not work with .JFIF image files.

So is there a way to make ConvertCopyImageFile work with .JFIF image files?
PeterPanino Posted - Mar 30 2014 : 04:46:02
Hi Nigel,

thanks! This works very well!

I need this in an environment where only single frame images are used. Thanks to all!
w2m Posted - Mar 29 2014 : 06:14:04
Nigel,

Doesn't the IEConvertImageFile function only convert single frame files? I believe so... then the best way to convert multi-frame files is to use ImageEnMIO isn't it?

William Miller
xequte Posted - Mar 29 2014 : 02:08:30
Hi Peter

If you are only doing a straight file to file conversion then you can use the IEConvertImageFile function in iexHelperFunctions.pas:

http://www.imageen.com/help/IEConvertImageFile.html

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
w2m Posted - Mar 28 2014 : 10:31:49
There is a problem with your example.

GIF files can have more than one frame, PNG files can hold only one frame, so if you tried to convert a multiframe gif file to png it is only possible to convert the first frame or convert all frames to individual png file... all with a different filename.

This can be done, but we have to know what you are trying to do?
Convert the first frame, convert a specific frame, or convert all frames?

The way this is coded depends on your needs, given the file formats you are converting from and converting to. I suppose you could design this to convert from one multi-frame format to another multi-frame format like GIF to TIF or GIF to icon or you could design it to only convert one frame to the destination file format regardless of the number of frames in the source file.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom ImageEn Development