[fpc-pascal] bug fpc-image
tazio mirandola
devsmt at gmail.com
Sat Jul 7 14:40:14 CEST 2012
hi all,
i'm trying to resize a jpg via fpc-image, this is the relevant code(adapted
from http://wiki.freepascal.org/fcl-image):
uses
fpimage, fpcanvas, FPImgCanv, fpreadjpeg,fpwritejpeg;
procedure TImgResize.Resample(AFileName:string);
var
Image : TFPCustomImage;
writer : TFPCustomImageWriter;
Reader : TFPReaderJPEG;
Canvas : TFPCustomCanvas;
begin
// Create an image
Image := TFPMemoryImage.Create(224,150);
Reader := TFPReaderJPEG.Create;
Image.LoadFromFile(AFileName (*, Reader*) );
//Image.SetSize(224,150);
// Attach the image to the canvas
Canvas := TFPImageCanvas.Create(image);
// Create the writer
Writer := TFPWriterJPEG.Create;
// Save to file
Image.SetSize(224,150);
Image.SaveToFile(AFileName+'b.jpg' (*, writer*) );
Canvas.Free;
Image.Free;
Writer.Free;
end;
actually, Image.SetSize(224,150); causes half of the resulting image being
black!
is it a bug or am i colling it wrongly?
--
Tazio Mirandola
Consulenza Software e Web
Cel:348 0836782 Skype:tazio.mirandola Http://evidenceweb.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120707/83db6ee4/attachment.html>
More information about the fpc-pascal
mailing list