MapInfo Pro Developers User Group

Expand all | Collapse all

How can i control Anti-Aliasing while doing a "Save Window As" with mapbasic?

  • 1.  How can i control Anti-Aliasing while doing a "Save Window As" with mapbasic?

    Posted 11-06-2018 07:04
      |   view attached

    See AttachedHi there,

     

    I'm trying to bring an old MapBasic program, written for MiPro 12 to MiPro 17. The program creates some layouts and saves them as PNG-Files.

    On the same machine i've installed MiPro 15 and MiPro 17.01 and when creating the PNG-Files with the same skript and source tables the files created with MiPro 15 are round about 3 - 5 times smaller, than the ones created by MiPro 17.01.

    The files itself have the same resolution and color depth, but when you look closer you see, that the images created by MiPro 15 arent anti-aliased while those created by MiPro 17 are.

     

    In the mapbasic program i disabled anything that can be disabled quality wise:

     

    set Map Window Q4_Map_ID Image Reprojection None

    Set Window Querformat_Layout_ID Smooth Vector None Smooth Text None Smooth Image None Export TrueColor On Export Antialiasing Off

    Set Window Q4_Map_ID Smooth Vector None Smooth Text None Smooth Image None Export TrueColor On Export Antialiasing Off

    Set Window Querformat_Layout_ID Enhanced Off

    Set Window Q4_Map_ID Enhanced Off

    Set Window Q4_Map_ID Export Transparency Raster ROP Export Transparency Vector Internal

    Set Window Querformat_Layout_ID Printer Name strMI_PRINTER_NAME Orientation Landscape Copies 1 Papersize 9 TrueColor On

    Set Window Querformat_Layout_ID Printer Transparency Raster ROP Printer Transparency Vector Internal

     

    [Q4_Map_ID is the real map-ID of the map shown in the layout]

     

    --> tried with "truecolor off" or other Transparency settings, made no difference in file sizes or anti-aliasing in the output images.

     

    This screenshot shows the layout window in the upper half and the resulting PNG-File underneath, and you can clearly see, that the map in the layout

    window is not anti-aliased, but the PNG-File is.

    The mapbasic command "Save Window" doesn't allow to set anti-aliasing, while the MiPro GUI does,

    and when you save a window in MiPro 17 with an open mapbasic window, once with and once without anti-aliasing, the commands are identical,

    but the file sizes and image apearances aren't.

     

    So it seems, that saving a window with MiPro 15 or earlier had "anti-aliasing off" as default, while in MiPro 17 it seems to be switched on.

    Attached you find two workspaces demonstrating the Problem and the two generated png-files via "Save Window as".

     

    Is there any way to control anti-aliasing when saving a window in MiPro 17?

     

    Thanks in advance

    and

    Cheers

     

    Stefan

     

    Attachment(s)

    ZIP
    Antialiasing_Problem.ZIP   650K 1 version


  • 2.  RE: How can i control Anti-Aliasing while doing a "Save Window As" with mapbasic?

    Posted 11-06-2018 07:26

    Hi Stefan

    I just tried it and I seem to be able to do it by only turning off the Anti-Alias for Text and Lines and then saving the map into a PNG:

    Set Window FrontWindow() Smooth Text None Smooth Vector None 

    Save Window FrontWindow() As "D:\1. Support\Untitled.png" Type "PNG" Width 26.0773 Units "cm" Height 14.605 Units "cm" Resolution 120

    If I turn the Antialias on again for Text and Vector, the resulting PNG is almost twice the size.



  • 3.  RE: How can i control Anti-Aliasing while doing a "Save Window As" with mapbasic?

    Posted 11-06-2018 07:36

    Hi Peter,

    You turned down Resolution from 305 to 120, that lowers file size. Your Settings don't, as i just tested.

    Take a close look at your resulting PNG-File. Is it antialiased?

     

    Thanks and Cheers

    Stefan



  • 4.  RE: How can i control Anti-Aliasing while doing a "Save Window As" with mapbasic?

    Posted 11-06-2018 07:53

    Unfortunately, I think you are right, Stefan, you can't control it.

    I was fooled by MapInfo Pro. It uses the setting used the last time you used the interface to create an image. If you disabled Anti-Alias, the image will not use Anti-Alias. If you had Anti-Alias turned on, so will the image you create with MapBasic afterwards.

    Let me check with engineering whether there is any workaround and why this has changes from v12.0.



  • 5.  RE: How can i control Anti-Aliasing while doing a "Save Window As" with mapbasic?

    Posted 11-06-2018 08:02

    Hi Peter,

    well, i just opened the MiPro_17.wor from my post and saved the layout via GUI without anti-aliasing.

    The file is the same size as automatically saved with the Workspace via mapbasic, and if you look closely, the file IS definitly anti-aliased.

    So even the Setting in the interface seems to mean something else.

    But thanks for Looking into it

    and Cheers from Germany

    Stefan



  • 6.  RE: How can i control Anti-Aliasing while doing a "Save Window As" with mapbasic?

    Posted 11-06-2018 09:35

    Stefan,

    I got this from Alicia, one of our software engineers.

    Can you try using this statement to turn AntiAlias on/off for Export:

    Set Window FrontWindow() Export Antialiasing [On | Off]

    Let us know if that works



  • 7.  RE: How can i control Anti-Aliasing while doing a "Save Window As" with mapbasic?

    Posted 11-06-2018 09:41

    Hi Peter,

    if you take a look at the Workspace AntiAliasing_Test_MiPro17.wor attached to my first post, you'll see, that this Setting was already applied, - and didn't Change a Thing.

    so no solution, sorry.

    Stefan



  • 8.  RE: How can i control Anti-Aliasing while doing a "Save Window As" with mapbasic?

    Posted 11-07-2018 03:26

    Hi Stefan

    I finally looked at your workspaces and could see that you had turned off the Anti-Alias for the map windows but not for the layout window.

    You will have to add this line after the Layout statement too:

    'Set anything ENHANCED to OFF

    Set Window FrontWindow() ScrollBars Off Smooth Vector None Smooth Text None Smooth Image None Export TrueColor Off Export Antialiasing Off

    But I'm not really sure that helps.

    When I look at the images I can't see any visual difference between the v15 and v17 images. But there is quite a difference in size which I can't account for: 102Kb versus 420Kb.

    v15

    v17



  • 9.  RE: How can i control Anti-Aliasing while doing a "Save Window As" with mapbasic?

    Posted 11-07-2018 03:33

    Good morning Peter,

    i tried that also, - no effect.

    And by the way, this is what the MapBasic-Help says About Setting Enhanced Statements to a layout window:

    ---------------------

    Using the following clauses on a Layout window generates an error that states that the clause cannot perform on the window.

    • Enhanced clause (for enhanced Rendering)

    ----------------------

    Funny enough, there is no error message, the Statement seems simply to be ignored.

     

    You cannot see the difference when Looking at that zoom Level. My last post showed two Pictures, where you can see the difference.

     

    Thanks anyway and Cheers

    Stefan



  • 10.  RE: How can i control Anti-Aliasing while doing a "Save Window As" with mapbasic?

    Posted 11-07-2018 03:42

    Right, I can see the difference when zoomed into the image.



  • 11.  RE: How can i control Anti-Aliasing while doing a "Save Window As" with mapbasic?

    Posted 11-08-2018 10:53

    Hi Peter,

    any News About this issue from developer-side?

    It Looks like a small issue, but for one of my customers, who produces literaly thousands of Pictures in different orientations and sizes for all it's dependances it's in fact a huge Problem. Right now with the old MiPro this scripted process results in a heap of 46 GB of pictures, and with the new MiPro 17 and a 3 - 5 times bigger filesize he faces 200 and more GB to put on an internal Team drive, and the Statement is, that this is not possible.

    Thanks again and regards.

    Stefan