In AS3, I am loading a png from a zip file (nochump's zip library through ByteArray to Loader). The png can be up to 45k pixels wide but only 120 tall. This creates a problem in flash, as images can only be ~8000 pixels wide. A possible solution would be to split the images into 6 columns somehow. This would probably need to be done in the ByteArray state, because the limitation is in Bitmap and Loader. Would this even be possible?
I believe you should use Alchemy to decode such a large file and put it in a Byterray. It looks like it has been done for JPEG, PNG shouldn't be very different!
http://segfaultlabs.com/devlogs/alchemy-loading-large-jpeg-images
All things are possible since you have the bytes. However this would require you to write a complete png library in actionscript. PNG is a very complicated and sophisticated compressed image format, so you can't just shred the image into blocks by copying portions of the ByteArray.
So really, the answer is no, it is not possible. Sorry.
If it was an uncompressed BMP on the other hand you would be in with a chance. However I suspect that if you are able to change the format of the file, it would be easier to pre-split the image into columns.
Related
We are participating at the RoboCup 2015 from the German Aerospace Center in October. Before the torunament we will get a 30x30 pixel sized TIFF image, representing a low-pixel heigtmap. My task is to write a fast and lightweight, dependency free code that reads this TIFF image an does some algorythmic stuff on it.
I googled about the TIFF image format and it seems there are some powerfull libraries, but is there a simple way of reading just the color values of the file?
I remember a format, don't know which, where I just skipped the first 30 bytes and then could read the color values in RGB. Do you have any code that could do that or an idea/explanation how I could acchieve that?
As I said, I do not need filename, imagesize data etc. I actually don't even know why they have choosen the TIFF image-format since its just a normal heightmap in greyscale, but however.
Every help is very appreciated.
Good evening programmers.
Please do not laugh, but by flash file is 270 MB.
My artists have gave me their final art to me via illustrator.
What I have been doing is opening up the illustrator file and copy and pasting the objects in to flash.
I have movieclips, buttons, tweens and graphics in my library ( 556 items)
How can I optimize my Flash because the swf file is 30MB.
I also have 10 AS3 files, my code doesn't slow the file down, it must be the images.
Thank you.
I've deleted the un used files from my library and have saved the update flash file as another .FLa file.
Hasn't decreased the file that much, still the swf is quite slow when it comes to gameplay.
Sorry for panicking.
When you have complicated shapes and vectors flash takes its time to render the graphics, hence the pause between one frame to another.
To have solved this I had first broke apart the shape and optimized it.
But you see this didn't optimize it to an extent.
The files my artists supplied me with were 100mb - 200mb per file size.
So instead of importing it from Ill to Flash wich was naive I had exported the file to a PNG , which is more than a JPEG but has properties such as transparent background and quality.
What I have done is replaced all my imported images with the PNG version of that image.
Since the PNG is a flat image, it means that FLASH doesn't have to render as much.
Thank you for your comments.
I have not found a way up until now to save an image as png into the isolated storage. The only save for images i found was the SaveJpeg(), but that way i loose the transperancy of the image. Does anyone know of another method that allows you to save the BitMapImage as .png to the IsolatedStorage?
ImageTools supports working with PNGs (encoding and decoding)
Plus, it has been asked a number of times... Saving Bitmap as PNG on WP7
My logic was incorrect. I was attempting to take a jpeg and then convert it to png which ended up in me loosing my transparency. I overlooked the fact that the "screenshot" feature i was using saved the stream to jpeg and then reused it. My mistake, I need to figure out how i can take a screenshot as png
I need to do OCR on a group of images. I have been using Tessnet and it works pretty well. The problem is that it seems to have problems with some images, so I thought that it might work better if I modify the images' brightness, contrast, etc. Also, the images are in .jpg format, but I read that .tiff is optimal.
What can I do? Should I just convert the JPEGs to TIFFs?
There's no point in converting the jpeg images to a lossless format like tiff, you will convert the artifacts as well. You could try and apply a sharpness kernel on the image before you try to do ocr on it.
Look at this page for more information.
public function bmdToStr(bmd:BitmapData,width:int,height:int):String {
var encoder:JPEGEncoder = new JPEGEncoder();
var encBytes:ByteArray = encoder.encode(bmd);
return ImageSnapshot.encodeImageAsBase64(new ImageSnapshot(width,height,encBytes,"image/jpeg"));
}
As of now, I am creating JPEG image from bitmapdata as above.
I can use PNGEncoder for creating png images as well.
How do I create .bmp or .gif files?
why would you create BMP? and for the same matter, why would you create a GIF?
the only interesting thing about GIF is, it supports animation. apart from that it's simply deprecated. if you want lossless compresion use PNG, if size is more important, use JPG. if it is really animation you want, I suggest you have a look at GIF Animation Encoder.
and BMP is totally not worth any consideration. it's just huge for 24 bit images (32 with transparency). an image 800x600 will result in 1.4 MB. BMP offers no advantages except the fact that it doesn't require decompression for display, but nowadays this makes virtually no difference, especially for the web.
if you really think, you need it, then you should simply lookup bmp specs. it's really straight forward.