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
 How to create multipage ICO file?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

graph_man

328 Posts

Posted - Oct 11 2022 :  10:50:01  Show Profile  Reply
Hello,

If I use

ImageEnView1->IO->Params->ICO_ImageIndex = 0;
ImageEnView1->IO->SaveToFileICO(AllSaveDialog_FileName);

ImageEnView1->IO->Params->ICO_ImageIndex = 1;
ImageEnView1->IO->SaveToFileICO(AllSaveDialog_FileName);

I am getting a file with one page ONLY.

I would like to have a function like
InsertToFileICO

Is there another way?
Somehow ImageEnMView->MIO->SaveToFileICO creates a multi-page ICO file.

xequte

38608 Posts

Posted - Oct 11 2022 :  22:37:13  Show Profile  Reply
Sorry, can you clarify what you are wanting? Not a multi-page icon file?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

graph_man

328 Posts

Posted - Oct 12 2022 :  04:26:08  Show Profile  Reply
I want to create a multi-page icon file.
See my code.
When calling the SaveToFileICO function, ImageEnView1 contains different images.
Go to Top of Page

xequte

38608 Posts

Posted - Oct 12 2022 :  16:00:06  Show Profile  Reply
Hi

OK, so ImageEn, by default, will create an icon file with multiple icons using a single image, if you set the sizes:

https://www.imageen.com/help/TIOParams.ICO_Sizes.html

e.g.

// Save the current image as 'output.ico'. It will contain three images with 64x64 32bit (24bit + alphachannel), 32x32 256 colors and 32x32 16 colors

// 64 x 64 x 32bit
ImageEnView.IO.Params.ICO_BitCount[0] := 32;
ImageEnView.IO.Params.ICO_Sizes[0].cx := 64;
ImageEnView.IO.Params.ICO_Sizes[0].cy := 64;

// 32 x 32 x 8bit
ImageEnView.IO.Params.ICO_BitCount[1] := 8;
ImageEnView.IO.Params.ICO_Sizes[1].cx := 32;
ImageEnView.IO.Params.ICO_Sizes[1].cy := 32;

// 32 x 32 x 4bit
ImageEnView.IO.Params.ICO_BitCount[2] := 4;
ImageEnView.IO.Params.ICO_Sizes[2].cx := 32;
ImageEnView.IO.Params.ICO_Sizes[2].cy := 32;

// Specify end of images
ImageEnView.IO.Params.ICO_BitCount[3] := 0;
ImageEnView.IO.Params.ICO_Sizes[3].cx := 0;
ImageEnView.IO.Params.ICO_Sizes[3].cy := 0;

// Save
ImageEnView.IO.SaveToFile('D:\output.ico');



If you want to create an multi-page icon from your own set of images, either use a TImageEnmView/TIEMultiBitmap, or IEWriteICOImages:

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


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

graph_man

328 Posts

Posted - Oct 13 2022 :  04:21:11  Show Profile  Reply
Your code shows how to create multiple pages from a single image.
As I wrote earlier, I need to create multipage ICO from different images.

How to use TIEMultiBitmap for this?

ps
Could you add InsertToFileICO function?
similar to other formats
Go to Top of Page

xequte

38608 Posts

Posted - Oct 16 2022 :  21:14:48  Show Profile  Reply
Hi

Unlike other multi-image formats, icon files are not intended to store different images, but rather different sizes and bit depths of the same image (so Windows can choose the best one for a particular usage). That is why ImageEn builds an icon file of multiple sizes using a single image.

If you want to create an icon file of all your own images, you can use:

// Create an icon file from ten source images
mbmp := TIEMultiBitmap.create;
for i := 0 to 9 do
  mbmp.AppendImage( format( 'D:\Source\Frame %d.bmp', [i] ));
mbmp.Write( 'D:\output.ico' );
mbmp.Free;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

graph_man

328 Posts

Posted - Oct 18 2022 :  16:45:02  Show Profile  Reply
Thanks
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: