
画像の負荷/保存、変換、変換を簡素化するためのDelphiライブラリ。 PNG、JPG、JXL、WebP、AVIF、TIFF、GIF、BMPをロード/保存できます。さまざまなリソースから画像を取得できます:ファイル、ストリーム、http、イメージャースト、関連するWindowsアイコン、実行可能ファイルアイコンなど...回転、フリップ、グレースケール、その他多くの変換。 GDI+、Graphics32、OpenCV、Vampyre、Libvipsエンジンが利用可能。
Githubでこのプロジェクトを「主演」してください!コードを参照するのに役立つだけです。 
このプロジェクトが役立つ場合は、寄付をすることを検討してください。
*新しい:Delphi 12 Athens Support
*新規:Libvipsエンジンが追加されました
*新規:インターフェイスベース
*新しい:vampyre libエンジンが追加されました
*新しい:新しい関数が追加されました
*新規:リファクタリークラス
*新しい:Delphinusサポート
ImageFXサポートの1つ以上を選択できます。以下の1つ以上のユニットを使用節に追加します。
Quick.imagefx.gdi: GDI+エンジンを使用します。外部ライブラリは必要ありませんが、遅いです。
必要なライブラリ:
Quick.imagefx.gr32: Graphics32エンジンを使用して、回転、変換、サイズ変更などを使用します
必要なライブラリ:
Quick.imagefx.opencv: opencvエンジン。 Intel Open Vision LibraryにThrid Party Delphi Warperを使用しています。それは非常に高速で強力です。プロジェクト監督にopencv外部dllが必要です。
必要なライブラリ:
Quick.ImageFX.Vampyre: Vampyre Imaging Library Engine。ヴァンパイアイメージングネイティブライブラリにスリッドパーティーのデルファイワーパーを使用します。高速で多くの画像形式をサポートします。
必要なライブラリ:
Quick.imagefx.vips: libvipsイメージングライブラリエンジン。 LibvipsライブラリにスリッドパーティーDelphi Warperを使用しています。 Ultra Fastで、Webp、Avif、JXLなどの多くの画像形式をサポートしています。
必要なライブラリ:
作成: ImageFXのインスタンスを作成して、画像をロード/操作します。
var
ImageFX : IImageFX;
begin
ImageFX := TImageFXGDI // You can create as TImageFXGDI, TImageFXGR32, TImageFXOpenCV or TImageFXVampyre to use different graphic engines
ImageFX.LoadFromFile( ' .test.jpg ' );
ImageFX.Rotate90;
ImageFX.SaveAsPNG( ' .Test.png ' );
end ;読み込み/保存: PNG、JPG、GIF、BMPをロード/保存し、ファイル、ストリーム、HTTP、イメージャースト、関連するWindowsアイコン、実行可能ファイルアイコンなどのさまざまなリソースから画像を取得できます...
// Load image from files like jpg, gif, png and bmp
ImageFX.LoadFromFile( ' .file.jpg ' );
// Load/Save image from/to a memorystream, filestream, etc...
ImageFX.LoadFromStream(MyStream);
ImageFX.SaveToStream(MyStream,ifJPG);
// Load image from an icon class
ImageFX.LoadFromIcon(MyIcon);
// Load image from an icon file
ImageFX.LoadFromFileIcon( ' .file.ico ' );
// Get image associated in windows with this type of extension
ImageFX.LoadFromFileExtension( ' .file.xls ' ,True);
// Load from exe resource
ImageFX.LoadFromResource( ' Main.ico ' );
// Get image from a http link
ImageFX.LoadFromHTTP( ' http://www.mysite.com/file.jpg ' ,ReturnHTTPCode,True);
// Load/Save from string
ImageFX.LoadFromString(MyImageString);
ImageFX.SaveToString(MyImageString);画像情報:画像の解像度、アスペクト比を取得します。
ImageFX.GetResolution(x,y)
ImageFX.AspectRatioStr // aspect ratio (4:3,16:9)
ImageFX.IsGray画像のサイズ:
// Resize image to fit max bounds of 500x300 and fills rest of target size with a border black color
ImageFX.ResizeOptions.BorderColor := clBlack;
ImageFX.Resize( 500 , 300 , rmFitToBounds, [rfCenter], rmLinear);
// Same image resize alternative/advanced mode
ImageFX.ResizeOptions.ResamplerMode := rmLinear;
ImageFX.ResizeOptions.ResizeMode := rmFitToBounds;
ImageFX.ResizeOptions.Center := True;
ImageFX.ResizeOptions.FillBorders := True;
ImageFX.ResizeOptions.BorderColor := clBlack;
ImageFX.Resize( 500 , 300 );seizeoptions:
NOMAGNIFY: TRUEの場合は、新しいサイズよりも最小の場合、画像をサイズ変更しない場合。
ResizeMode:サイズのアルゴリズムを変更して、目的の最終サイズを計算します。
Resamplermode:適用するアルゴリズムのサイズ変更:
センター:センター画像
塗りつぶし:小さい場合は、宛先の長方形のスケーリングされた画像の境界を埋めます。
Bordercolor:充填境界の色。
変換:回転、フリップ、スキャンライン効果、明るいもの、その他の変換を画像に適用します。
// Rotate image 90 degrees
ImageFX.Rotate90;
// Rotate image 45 degrees
ImageFX.RotateAngle( 45 );
// Convert to grayscale
ImageFX.GrayScale;
// Flip image horizontally
ImageFX.FlipX;
// Increase bright by 50%
ImageFX.Lighten( 50 );
// Change color of a pixel
PixInfo.R := Random( 255 ); // R
PixInfo.G := Random( 255 ); // G
PixInfo.B := Random( 120 ); // B
PixInfo.A := 200 ; // Alpha
imageFX.Pixel[x,y] := PixInfo;
// Draw an overlay image over current image with 50% transparency
ImageFX.DrawCentered(pngimage, 0.5 );フォーマット変換:画像形式間で変換できます。
ImageFX.LoadFromFile( ' .myfile.jpg ' );
ImageFX.SaveAsPNG( ' .myfile.png ' );ほぼすべての関数が自己クラスを返すので、次のような多くのアクションと効果をチェーンできます。
// Rotate 90 degrees and flip horizontally, convert to grayscale and save to a png file.
ImageFX.Rotate90.FlipX.GrayScale.SaveToPNG( ' .myfile.png ' );
// Load from file, rotate180, resize to 100x100 and assign to a TImage.
MyImage.Picture.Asssign(ImageFX.LoadFromFile( ' .myfile.jpg ' ).Rotate180.Resize( 100 , 100 ).AsBitmap);Delphiを学びたいですか、それともスキルを向上させたいですか? LearnDelphi.org