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
 Problem with resampling

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
BionicWave Posted - Feb 12 2012 : 04:03:52
I have the following code:

img := TImageEnView.Create(nil);
img.IO.LoadFromFilePNG(aFileName);
img.Proc.Resample(32,32);
img.IO.SaveToFileICO(ExchangeFileExt(aFileName,'.ico'));
img.Free;

It runs without problems (have try/except and a logging function)
But the resulting ico-file is 64x64!
No matter what i set as a size to resample to.
What am i doing wrong?
I want the icon to be 32x32 pixels in with and height.
Do i have to call another function to fix the size?

thanks
2   L A T E S T    R E P L I E S    (Newest First)
BionicWave Posted - Feb 12 2012 : 08:18:44
That is a function i wrote myself.


Thanks for the answer.
Saved my day.
w2m Posted - Feb 12 2012 : 06:36:34
Icons and cursors are a little strange in ImageEN compared to most of the other image types.

// this loads a png file, resamples it to 32x32 and saves the result as an icon
var
  img: TImageEnView;
  aFileName: string;
begin
  img := TImageEnView.Create ( nil );
  try
    if OpenPictureDialog1.Execute then
    begin
      aFileName := OpenPictureDialog1.FileName;
      if LowerCase( ExtractFileExt( aFileName ) ) = '.png' then
      begin
        img.IO.LoadFromFilePNG ( aFileName );
        img.Proc.Resample ( 32, 32, rfNone, True );
        img.IO.Params.ICO_Sizes [ 0 ].cx := 32;
        img.IO.Params.ICO_Sizes [ 0 ].cy := 32;
        img.IO.SaveToFileICO ( ChangeFileExt ( aFileName, '.ico' ) );
      end;
    end;
  finally
    img.Free;
  end; 
end;


... but I am surprised your code even compiles because there is no ExchangeFileExt function that I am aware of... try ChangeFileExt instead.

William Miller