xsharp.eu • Image resize with FabPaintLib
Page 1 of 3

Image resize with FabPaintLib

Posted: Mon Oct 28, 2019 12:55 pm
by lagraf
Hi,
one of my clients, a model agency, has to resize jpgs with sizes at about 6300x9000px, 300dpi to 283x???px (??? due to aspect ratio), 72dpi. I do this with VO and FabPaintLib:

DIBResizeBilinear(oCurrWin:oImg:pDibObject, _WIDTH, nHeight)
DIBSaveAsJPEG(oCurrWin:oImg:pDibObject, String2Psz(cFile))

I tried Bilinear, Box, Hamming, Gauss functions from FabPaintLib and I tried JPEG, PNG, TIFF. But the quality of all is far away from the one my client gets doing it with Photoshop!

Is there a way with FabPaintLib or is there another way to do this resize to get nearly Photoshop quality?

Regards, Franz

Image resize with FabPaintLib

Posted: Mon Oct 28, 2019 6:13 pm
by wriedmann
Hi Franz,
for sure you will never be able to reach the quality of PhotoShop - they have their own algorithms, and I have my doubts they will release them as product.
So if you need PhotoShop quality you need to see if you can automate the use in some manner.
But there is another excellent image manipulation tool from the Unix/Linux world: the GD lib.
A few years ago I have found a port for Windows and built both a VO library and a sample.
You can find it here:
https://riedmann.it/download/GD_Demo.zip
Wolfgang

Image resize with FabPaintLib

Posted: Tue Oct 29, 2019 5:28 am
by lagraf
Hi Wolfgang,
thanks for sample, I will test it to see if it gives better quality than FabPaintLib!
Franz

Image resize with FabPaintLib

Posted: Tue Oct 29, 2019 6:06 am
by wriedmann
Hi Franz,
the FabPaint library is using another free image manipulation library: the PaintLib.
The GD library is used by many webservers and normally works well.
There is another graphics library in the Unix/Linux world: GraphicsMagick http://www.graphicsmagick.org/INSTALL-windows.html used for example by Typo3.
GraphicsMagic once installed needs to be called by a command line, so it could be another possibility, but again I don't think it will reach the PhotoShop quality.
Wolfgang

Image resize with FabPaintLib

Posted: Tue Oct 29, 2019 6:10 am
by wriedmann
Hi Franz,
I have seen now that the GraphicsMagick library in its Windows version offers also a COM object.
For trying it out I would use the commandline program.
Wolfgang

Image resize with FabPaintLib

Posted: Tue Oct 29, 2019 7:05 am
by lagraf
Hi Wolfgang,
your GD_Demo saves the image in ConvertImage:CreateButton with 200 dpi, but I don't see where the dpi is set:
gdImageCopyResampled( strResize, strImage, 0, 0, 0, 0, oDCWidth:Value, oDCHeight:Value, strImage.sx, strImage.sy )
Is it possible to reduce dpi to 72dpi?
Franz

Image resize with FabPaintLib

Posted: Tue Oct 29, 2019 8:09 am
by wriedmann
Hi Franz,
dpi is relative, you can set the factor using the parameters.
Wolfgang
P.S. I have to explain to graphics people all the time that an image has a size but no dpi, as dpi is effectively a display issue. If you know the size of the image on the screen or the printer, you can calculate how many pixels of with or height do you need - based on the dpi of the output device

Image resize with FabPaintLib

Posted: Tue Nov 05, 2019 10:52 am
by lagraf
I sent some pics produced with GD and ImageMagick to my client, let's see what he says to their quality. I think ImageMagick does the best one but needs some secs.
Thanks, Franz

Image resize with FabPaintLib

Posted: Tue Nov 05, 2019 11:20 am
by wriedmann
Hi Franz,
I have no doubts ImageMagick works better - it is the much larger library, and it is also the preferred choice in the Typo3 CMS.
But with the resizing factors you gave me ( 6300 x 9000 to 287 x 404 ) I don't think these open source libraries will reach the quality of a professional package like Adobe PhotoShop - Adobe has invested much more money and time in their algorithms (to be honest, they have many, many times the resources an opensource project can have).
Wolfgang

Image resize with FabPaintLib

Posted: Tue Nov 05, 2019 2:08 pm
by FFF
Franz,
if the IM is not accepted, you might try with RawTherapee. Yes, a "Raw" converter, but with a lot of possibilities - and free. Has a commandline interface... Runs on Windows, Linux and Macos. Win install is straightforwarde. Made a quick try resizing one of my jpgs and to my non-professionial eye the result looks good.