Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1
  • 2

TOPIC:

Image resize with FabPaintLib 28 Oct 2019 13:55 #11491

  • lagraf
  • lagraf's Avatar
  • Topic Author


  • Posts: 338
  • 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

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 28 Oct 2019 19:13 #11496

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3366
  • 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:
    riedmann.it/download/GD_Demo.zip
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 29 Oct 2019 06:28 #11502

    • lagraf
    • lagraf's Avatar
    • Topic Author


  • Posts: 338
  • Hi Wolfgang,
    thanks for sample, I will test it to see if it gives better quality than FabPaintLib!
    Franz

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 29 Oct 2019 07:06 #11503

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3366
  • 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 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

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 29 Oct 2019 07:10 #11504

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3366
  • 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

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 29 Oct 2019 08:05 #11505

    • lagraf
    • lagraf's Avatar
    • Topic Author


  • Posts: 338
  • 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

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 29 Oct 2019 09:09 #11506

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3366
  • 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

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 05 Nov 2019 11:52 #11594

    • lagraf
    • lagraf's Avatar
    • Topic Author


  • Posts: 338
  • 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

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 05 Nov 2019 12:20 #11595

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3366
  • 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

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 05 Nov 2019 15:08 #11596

    • FFF
    • FFF's Avatar


  • Posts: 1421
  • 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 (X# 2.16.0.5; Xide 2.16; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 05 Nov 2019 17:50 #11608

    • lagraf
    • lagraf's Avatar
    • Topic Author


  • Posts: 338
  • Is it possible that Version 5.x only runs on 64 bit?
    I only see previous versions for 32bit.

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 05 Nov 2019 21:00 #11609

    • FFF
    • FFF's Avatar


  • Posts: 1421
  • Could well be. Do you need 32bit?? You might try an older version, or, better, ask at their forum. Folks are relatively helpful there ;)
    Regards
    Karl (X# 2.16.0.5; Xide 2.16; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 06 Nov 2019 21:46 #11624

    • Jamal
    • Jamal's Avatar


  • Posts: 309
  • I wrote a COM library in C# which uses .NET System.Drawing where you can set the image size and dpi.
    This is callable from VO after generating an Automation Server Class.

    If you wish, I can post the the library and sample code on usage. I can't promise quality; that's for you to judge.

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 07 Nov 2019 07:00 #11631

    • lagraf
    • lagraf's Avatar
    • Topic Author


  • Posts: 338
  • Hi Jamal,
    I also have to select image cutouts which I have to crop out of the big image. Can your lib do this?

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 07 Nov 2019 10:23 #11636

    • Jamal
    • Jamal's Avatar


  • Posts: 309
  • Hi Franz,

    No, it will only resize the image. First, try the attached library for sizing the image and if that's meets your expectation, then If you want to crop the image via mouse, then I guess I can add it based on some code from stackoverflow. This will be purely a .NET form callable from VO. The issue with this you won't be able to customize the form unless you know c# and have the source code of the lib which I will make available. If so, let me know I will write it in a few days; hopefully it will work as expected.

    Jamal

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 07 Nov 2019 11:14 #11638

    • lagraf
    • lagraf's Avatar
    • Topic Author


  • Posts: 338
  • Hi Jamal,
    thank you for your offer, but I already have a running implementation with ImageMagick and so you don't have to do the work (unless you need it too)! My App does the following with FabPaintLib:
    - Open image
    - Manipulate image (rotation, contrast, brightness, intensity, gray, invert) and much more
    - Zoom in/out
    - set and move cutout
    - crop cutout

    And here comes ImageMagick into play:
    - I transfer the FabPaintLib coordinates into ImageMagick needs
    - I start a commandline script which crops the cutout, resamples it to 72 dpi, resizes it to 283x397 and saves it

    Another need ist to resample and resize full images to 283x397, here no cutout is needed. In both cases the quality of the result is important. ImageMagick brings a much better quality to output image than FabPaintLib which I used before for resampling and resizeing.

    If your DLL could do this instead of ImageMagick it would be a benefit, ImageMagick needs an installation of 85MB, and the job is startet via commandline with no return code.

    Franz

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 07 Nov 2019 11:39 #11639

    • Jamal
    • Jamal's Avatar


  • Posts: 309
  • Hi Franz,

    Well, for now try the attached DLL in the previous post for image sizing; I thought that was your original requirement. It's only a few KB.
    Actually, I will do the crop feature as an exercise later. It may come in handy for me some day.

    Jamal

    Note: please see the included readme.txt for DLL registration.

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 13 Nov 2019 10:27 #11722

    • lagraf
    • lagraf's Avatar
    • Topic Author


  • Posts: 338
  • Meanwhile I tested some image processing libs and progs: PaintLib, GD, ImageMagick, RawTherapee. ImageMagick gives the best results in quality, I tested with commandline call.

    Does anyone know how I can use ImageMagick DLL with VO 2.8 and which files do I need or do I have to install full IM?

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 13 Nov 2019 10:43 #11723

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3366
  • Hi Franz,

    ImageMagick gives the best results in quality

    this is not really a surprise for me.... had expected something like that.

    Does anyone know how I can use ImageMagick DLL with VO 2.8 and which files do I need or do I have to install full IM?

    AFAIK you have to do a full install,and I would stick with the commandline call. Since there is no binding for VO, you have to study and to adapt the C API. I don't think anyone has done that already...
    But it seems you like the hard way.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Image resize with FabPaintLib 13 Nov 2019 11:27 #11724

    • lagraf
    • lagraf's Avatar
    • Topic Author


  • Posts: 338
  • Hi Wolfgang!
    No I don't like and the user doesn't pay the hard way! If I have to install full prog and there's no easy way with one or a few DLLs I can use within VO, I do it with command line!
    Thank you, Franz

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1
    • 2