Alchemy - loading large jpeg images

over 2 years ago malczak alchemy comments

In AIR 1.5 and Flash Player 10 the maximum size for a BitmapData object is restricted so that total number of pixels cannot exceed 16,777,216 pixels. Lets say we need (for some reason) to use larger image. We cannot use Loader class to load it because we will get runtime error. But still much larger images can be loaded using libjpeg ported with use of alchemy project.

What we need to do, is to binary load jpeg file to a ByteArray object. In next step we can use libjpeg to decode image. Resulting image cannot be stored in BitmapData object, but it can be still stored in ByteArray object. We don't have any size restriction for ByteArray objects. Finally we can display loaded image by dividing it into several BitmapData objects
In example below, application reads JPEG image, of 8192x8192 pixels dimension. Image is asynchronously decoded with ported libjpeg. When bitmap is decompressed, part of it, of dimensions 320x240 pixels, is displayed.

Flash player (ver. 10.0.0) is required to see this content. Please update to newest possible version.

Get newest Adobe Flash player


notes:

  • 'load local jpeg' - use this to load image from Your hard drive
  • 'load 8192x8192 jpeg' - this loads large jpeg from web, this image is more 4.4MB
  • decompressing is slow but this can be tuned c code
  • use right click to view source

Alchemy code for libjpeg will be also published soon.

Comments

over 1 year ago Martin Rossil #0

This is an awesome project!

Thanx for creating this.

But I have a problem with the colors!

Something is wrong when creating the bitmap, I hope you can come with a fix for this?

Keep up the mindblowing work!

/Martin

about 1 year ago saint #1

works fine but the colors!

10 months ago Alex http://quadroland.com/ #2

Hey Malczak!
You did a good job!
I would like to use your asynchronous decoder for big images. The only problem is the colors.
Can we work it out?
I will be happy to pay for that.
I also tried to get you via email but had no luck.
Please contact me
Alex

New comment

  1. (with http or https prefix)

  2. (use [code][/code] tags to post a code snippet)

  3. (javascript is required)

Website content premeditately commited by malczak & sobstel.
Layout by mlando. Icons by dryicons.com. All rights reserved.