Image resize with FabPaintLib

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
lagraf
Posts: 450
Joined: Thu Jan 18, 2018 9:03 am
Location: A

Image resize with FabPaintLib

Post 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
User avatar
wriedmann
Posts: 3757
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Image resize with FabPaintLib

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
lagraf
Posts: 450
Joined: Thu Jan 18, 2018 9:03 am
Location: A

Image resize with FabPaintLib

Post by lagraf »

Hi Wolfgang,
thanks for sample, I will test it to see if it gives better quality than FabPaintLib!
Franz
User avatar
wriedmann
Posts: 3757
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Image resize with FabPaintLib

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3757
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Image resize with FabPaintLib

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
lagraf
Posts: 450
Joined: Thu Jan 18, 2018 9:03 am
Location: A

Image resize with FabPaintLib

Post 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
User avatar
wriedmann
Posts: 3757
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Image resize with FabPaintLib

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
lagraf
Posts: 450
Joined: Thu Jan 18, 2018 9:03 am
Location: A

Image resize with FabPaintLib

Post 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
User avatar
wriedmann
Posts: 3757
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Image resize with FabPaintLib

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
FFF
Posts: 1582
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Image resize with FabPaintLib

Post 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.
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Post Reply