User Tag List

Results 1 to 7 of 7

Thread: Saving JPEG with quality

  1. #1
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    1,811
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    Question Saving JPEG with quality

    Heyo C++ers,
    I'm using ExportImage() with a cSurface, and it works fine, but my client wants variable quality so I need work out how to set JPEG quality when I export.

    There's a SetCompressionLevel() function in CImageFilterMgr, but it's not documented. There's nothing for other cSurface related to compression or quality.

    How do I access the main feature of a lossy format in the Fusion SDK?

    Cheers,
    ~Phi

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export Module
    conceptgame's Avatar
    Join Date
    Apr 2011
    Location
    Switzerland
    Posts
    738
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    With SetCompressionLevel() between 0 (worst) an 100 (best), you can set the quality. I think 75 if you do not define anyting but I am not sure.
    Value parameter is an integer.

  3. #3
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    1,811
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    When you're looking up a filter's extensions, they're in "bmp" format.

    How do I do a save of a cSurface? Do I pass LockBuffer() to it?
    Code:
    // Higher quality equals lower compression.
    pFilter->SetCompressionLevel(101 - quality);
    
    LPBYTE buffer = psf->LockBuffer();
    cSurface * psf = /* was already init'd */;
    pFilter->Save(snapshotPathANSI.c_str(), buffer, psf->GetWidth(), psf->GetHeight(), 24, psf->GetPitch(), nullptr);
    Something like that?

  4. #4
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    1,811
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Yep, that parameter set works. Output of Save() is "IF_OK" if okay, otherwise IF_XXX error. There's the full code of ExportImage in the SDK help file if you search it.


    But the compression level doesn't appear to be adjusting. I manually save through the whole range, and the output files are the same size and have the same hash.
    The data is completely fresh cSurface *s and filter classes, so I know I'm not reusing things. I've jumped in at runtime and the quality is passed properly.

    I may be using an old mmfs2.lib - will that change anything? Was this fixed at some point?

    EDIT: I upgraded to the latest in the clickteam-plugin/windows repo and it didn't change anything. Same issue.

  5. #5
    Clicker Fusion 2.5 DeveloperSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,739
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)
    I can't help you, but looking at the Surface source I originally intended for there to be a quality setting when saving JPEGs, but I scrapped it - perhaps for the same reason. (Disclaimer: That was a long time ago)

  6. #6
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    1,811
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Thanks Looki, I did check Surface source code before I posted.
    I've now dropped a bugbox ticket, but results are perturbing.

  7. #7
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    1,811
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Yves saved the day and implemented it! You have to overwrite the JPEG Image Filter, though.
    You can tack in some JPEG compression to Surface now Mr. Looki!

Similar Threads

  1. Possible to change Quality?
    By Outcast in forum SWF/Flash Export Module Version 2.0
    Replies: 2
    Last Post: 29th July 2013, 06:07 AM
  2. [Request] Advanced JPEG Object
    By Dines in forum Extension Development
    Replies: 10
    Last Post: 27th April 2009, 02:27 PM
  3. jpeg compression
    By gamer4fun in forum Multimedia Fusion 2 - Technical Support
    Replies: 23
    Last Post: 11th June 2007, 03:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •