|
PNG comprimido e com borda transparente perfeita |
Iniciado por Boller, 09,jun. 2020 15:02 - No hay respuesta |
| |
| | | |
|
| |
Miembro registrado 3.651 mensajes Popularité : +175 (223 votes) |
|
Publicado el 09,junio 2020 - 15:02 |
Usando o https:
PNG transparente perfeito
Procedure CompressIMG(sFile, sSave = "", nWidth = 0, nColor = LightMagenta)
Image is Image nOriginalSize is int = fSize(sFile) nCompressSize is int = 0 nOX is int nOY is int nRatio is numeric sPNGQ is string = fExeDir + "\Lib\pngquant.exe"
Image = dLoadImage(sFile)
IF nWidth > 0 THEN nOX = Image..Width nOY = Image..Height nRatio = nOX / nOY IF nOX > nOY THEN dResize(Image, nWidth, Round(nWidth / nRatio),drHighQuality+drHomothetic) ELSE dResize(Image, nWidth, Round(nWidth * nRatio),drHighQuality+drHomothetic) END END
IF sSave = "" THEN sSave = sFile END
IF fExtractPath(sFile,fExtension) ~~ ".png" THEN
IF nWidth > 0 THEN dSaveImagePNG(Image, sSave, nColor) ELSE fCopyFile(sFile, sSave) END ExeRun(StringBuild([ "%1" %2 "%3" ], sPNGQ, "--f --ext=.png --skip-if-larger --strip --nofs --quiet --quality=45-80", sSave), exeIconize, exeWait) ExeRun(StringBuild([ "%1" %2 "%3" ], sPNGQ, "--f --ext=.png --skip-if-larger --strip --nofs -quiet --ordered --speed=1 --quality=50-85", sSave), exeIconize, exeWait) nCompressSize = fSize(sSave) IF nCompressSize > 0 _AND_ nCompressSize < nOriginalSize THEN RESULT True END
ELSE IF fExtractPath(sFile,fExtension) ~~ ".jpg" _OR_ fExtractPath(sFile,fExtension) ~~ ".jpeg" THEN sSave = fExtractPath(sSave,fFileName+fDirectory+fDrive) + "_temp.jpg" IF dSaveImageJPEG(Image, sSave, 65) THEN nCompressSize = fSize(sSave) IF nCompressSize > 0 _AND_ nCompressSize < nOriginalSize THEN fDelete(sFile) fRename(sSave, sFile) RESULT True END END END
RESULT False
by Laerte / Bruno
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | | | |
| | |
|