Jump to content



Photo

Air Native Extension

flex actionscript3 image magick

  • Please log in to reply
3 replies to this topic

#1 Necuima

Necuima

    Advanced Member

  • Members
  • PipPipPip
  • 255 posts
  • LocationSunshine Coast, Queensland, Australia

Posted 4 January 2015 - 8:38 PM

Hi,

 

This is another of my 'lessons learned' posts that may be of use to someone attempting a similar endeavour.

 

After countless hours and a lot of help, I have managed to get an AIR Native Extension incorporating simple Image Magick functionality working.  Although, so far at least, I have not achieved my ultimate objective, I do have an AIR native extension incorporating simple Image Magick functionality working on my PC.

 

The 'ultimate objective' was to create a Windows exe file/application which could be installed on anyone's PC without the need for that PC to have Image Magick also installed - that has so far eluded me, but if that PC has Image Magick installed in the manner necessary, then the application will indeed work on another PC.

 

The basic development process is as follows:

 

1) build a dll which has both Image Magick and AIR native extension connectivity (I used MS Visual C++ 2010 Express Edition as my IDE).

2) build a library (I used Flash Builder 4.6) incorporating a class and then from that build an ane file.

3) build a Flash Builder AS3/Flex project to use the functionality developed in steps 1 and 2 which incorporates the ane file from step 2.

 

Detailed guidance for the AIR bits can be found at http://easynativeext...l-introduction/ which did not exist when I started this endeavour but many thanks to Radoslava Leseva for her invaluable help in this bit.

 

I used the Wand interface to Image Magick and guidance on that can be found at http://members.shaw....emo/MagickWand/ and http://www.imagemagick.org/discourse-server/viewtopic.php?t=11757

 

The application, via a simple user interface (UI - step3), allows the user to select a jpg image file for downsizing.  The UI also requests a new pixel size parameter as well as a jpg quality/compression factor.

 

The class (step 2) has an instance constructor and a method.  The UI calls the method passing it the full path name of the jpg image file to be downsized as well as the size and quality parameters.  The method then calls a resize function in the dll which in turn uses the Image Magick Wand interface to do the actual resizing.

 

I know that there are easier ways to downsize a jpg image but I wanted to learn how to develop an AIR native extension!

 

I am impressed with the quality of the downsized images.  As a test I downsized an 18Mb high quality image to a file about 150Kb in size and on my 24 inch screen I cannot detect any reduction in the visual quality of the image.  That of course is due to the Image Magick functionality.

 

I hope that this may be of help to someone!

 

Cheers from Oz.


  • 0

#2 Larry

Larry

    Administrator/Writer

  • Administrators
  • 4766 posts
  • LocationState College, PA (USA)

Posted 6 January 2015 - 9:42 AM

Thank you so much for sharing all that! Amazing amount you've learned here!


  • 0

#3 ruicruz

ruicruz

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 28 October 2016 - 1:30 PM

Hi Necuima,

 

Could you please share your ImageMagik.ane and ImageMagik.swc?

 

 

Kind regards,

Rui


  • 0

#4 Necuima

Necuima

    Advanced Member

  • Members
  • PipPipPip
  • 255 posts
  • LocationSunshine Coast, Queensland, Australia

Posted 25 November 2016 - 7:55 PM

Hi Rui,

 

Sorry that I did not get back to you sooner.

 

For some reason I cannot copy and paste code into a reply such as this without typing it all in line by line.

 

If you ask Larry for my email address, it's OK if he lets you know what it is and then you can email me and I can attach the code in a reply.

 

Cheers, Necuima


  • 0





Also tagged with one or more of these keywords: flex, actionscript3, image magick