¿Como cambiar el tamaño a una imagen?
BUenos dìas
¿Como puedo cambiar el tamaño de una imagen antes de que el usuario la pretenda guardar en un campo blob? Gracias. |
BUeno aqui encontre esto:
es una funcion que recibe una imagen jpg y luego la guarda en el disco duro ya con el tamaño que se especifico. Recibe el nombre de la imagen con todo y ruta y luego donde va a quedar y con que nombre, y el alto y ancho. function resizeImage(sInImage, sOutImage: string; iHeight, iWidth: integer): boolean; var JpgImg : TJpegImage; BmpImg : TBitmap; Rectangle: TRect; begin try JpgImg := TJpegImage.Create; BmpImg := TBitmap.Create; JpgImg.LoadFromFile(sInImage); Rectangle := Rect(0, 0, iWidth, iHeight); with BmpImg do begin Width := iWidth; Height := iHeight; Canvas.StretchDraw(Rectangle, JpgImg); end; finally JpgImg.Assign(BmpImg); JpgImg.SaveToFile(sOutImage); JpgImg.Free; BmpImg.Free; end; Result := True; end; |
La franja horaria es GMT +2. Ahora son las 08:54:39. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi