Follow-up
I have tested adding png images to TImageEnMView and I have found that MIO correctly saves the icon. It appears MIO works correctly but IO does not.
One advantage of using TImageEnMView versus TImageEnView is that saving and loading multiframe icons is much simpler with TImageEnMView than TImageEnView.
procedure TForm1.Add1Click(Sender: TObject);
var
iFrame: integer;
begin
if OpenPictureDialog1.Execute then
begin
iFrame := ImageEnMView1.AppendImage(OpenPictureDialog1.FileName);
ImageEnMView1.ImageTopText[iFrame] := 'Frame ' + IntToStr(iFrame+1);
ImageEnMView1.ImageBottomText[iFrame] := IntToStr(ImageEnMView1.MIO.Params[iFrame].Width) + ' x ' + IntToStr(ImageEnMView1.MIO.Params[iFrame].Height) + ' ' +
IntToStr(ImageEnMView1.MIO.Params[iFrame].BitsPerSample * ImageEnMView1.MIO.Params[iFrame].SamplesPerPixel) + '-bit';
ImageEnMView1.CopyToIEBitmap(iFrame, ImageEnView1.IEBitmap);
ImageEnView1.Update;
StatusBar1.Panels[2].Text := 'Width: ' + IntToStr(ImageEnMView1.MIO.Params[iFrame].Width);
StatusBar1.Panels[3].Text := 'Height: ' + IntToStr(ImageEnMView1.MIO.Params[iFrame].Height);
end;
end;
procedure TForm1.Open1Click(Sender: TObject);
var
i: integer;
begin
OpenPictureDialog1.InitialDir := WindowsDesktopFolder;
if OpenPictureDialog1.Execute then
begin
ImageEnMView1.Clear;
ImageEnMView1.MIO.LoadFromFile(OpenPictureDialog1.FileName);
for i := 0 to ImageEnMView1.ImageCount-1 do
begin
ImageEnMView1.ImageTopText[i] := 'Frame ' + IntToStr(i+1);
ImageEnMView1.ImageBottomText[i] := IntToStr(ImageEnMView1.MIO.Params[i].Width) + ' x ' + IntToStr(ImageEnMView1.MIO.Params[i].Height) + ' ' +
IntToStr(ImageEnMView1.MIO.Params[i].BitsPerSample * ImageEnMView1.MIO.Params[i].SamplesPerPixel) + '-bit';
end;
ImageEnMView1.SelectedImage := 0;
ImageEnMView1.CopyToIEBitmap(ImageEnMView1.SelectedImage, ImageEnView1.IEBitmap);
ImageEnView1.Update;
Caption := 'Icons- ' + OpenPictureDialog1.FileName;
StatusBar1.Panels[0].Text := ExtractFileDir(OpenPictureDialog1.FileName);
StatusBar1.Panels[1].Text := ExtractFileName(OpenPictureDialog1.FileName);
StatusBar1.Panels[2].Text := 'Width: ' + IntToStr(ImageEnMView1.MIO.Params[ImageEnMView1.SelectedImage].Width);
StatusBar1.Panels[3].Text := 'Height: ' + IntToStr(ImageEnMView1.MIO.Params[ImageEnMView1.SelectedImage].Height);
end;
end;
procedure TForm1.Remove1Click(Sender: TObject);
var
i: integer;
begin
ImageEnMView1.DeleteImage(ImageEnMView1.SelectedImage);
ImageEnMView1.Update;
for i := 0 to ImageEnMView1.ImageCount-1 do
ImageEnMView1.ImageTopText[i] := 'Frame ' + IntToStr(i+1);
ImageEnMView1.CopyToIEBitmap(ImageEnMView1.SelectedImage, ImageEnView1.IEBitmap);
ImageEnView1.Update;
StatusBar1.Panels[2].Text := 'Width: ' + IntToStr(ImageEnMView1.MIO.Params[ImageEnMView1.SelectedImage].Width);
StatusBar1.Panels[3].Text := 'Height: ' + IntToStr(ImageEnMView1.MIO.Params[ImageEnMView1.SelectedImage].Height);
end;
procedure TForm1.Save1Click(Sender: TObject);
begin
ImageEnMView1.MIO.SaveToFile(ImageEnMView1.MIO.Params[0].FileName);
Caption := 'Icons- ' + ImageEnMView1.MIO.Params[0].FileName;
StatusBar1.Panels[0].Text := ExtractFileDir(ImageEnMView1.MIO.Params[0].FileName);
StatusBar1.Panels[1].Text := ExtractFileName(ImageEnMView1.MIO.Params[0].FileName);
StatusBar1.Panels[2].Text := 'Width: ' + IntToStr(ImageEnMView1.MIO.Params[0].Width);
StatusBar1.Panels[3].Text := 'Height: ' + IntToStr(ImageEnMView1.MIO.Params[0].Height);
end;
procedure TForm1.SaveAs1Click(Sender: TObject);
begin
if SavePictureDialog1.Execute then
begin
ImageEnMView1.MIO.SaveToFile(SavePictureDialog1.FileName);
Caption := 'Icons- ' + SavePictureDialog1.FileName;
StatusBar1.Panels[0].Text := ExtractFileDir(SavePictureDialog1.FileName);
StatusBar1.Panels[1].Text := ExtractFileName(SavePictureDialog1.FileName);
StatusBar1.Panels[2].Text := 'Width: ' + IntToStr(ImageEnMView1.MIO.Params[ImageEnMView1.SelectedImage].Width);
StatusBar1.Panels[3].Text := 'Height: ' + IntToStr(ImageEnMView1.MIO.Params[ImageEnMView1.SelectedImage].Height);
end;
end;
Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development