Copy link to clipboard
Copied
Hi,
what I want to do is actually the same as CameraRoll.addBitmapData(DATA) is doing - but in a good quality as the mentioned function saves the image in a really, really bad quality as JPEG.
Thanks
Christian
Copy link to clipboard
Copied
Since Adobe still only supports JPEG which is lacking when you might want to really use 32-bit PNG with optional transparency, I recommend using one of the various ANEs out there that support exporting Photos and also adds support for PNG.
Copy link to clipboard
Copied
So at least it would be fine for us to save the image in a GOOD quality as a jpeg to the devices standard directory for photos?
Isn't there any way to do this without native extensions? We often had problems that something is crashing in 3rd party native extensions which is sometimes hard to find out and even harder or impossible to fix...
Copy link to clipboard
Copied
On Android you could possibly do this without a native extension, although technically you should really be saving files into the standard Android photo directory for the OS, which can only be gotten with a native call to (Java code below):
File path = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES);
(sure you could guess various default folders you might find on the web, but some versions of the OS have now abstracted this folder so it isn't the same guaranteed location. It is important to use the right folder otherwise other apps or default photo browsing app won't see the images your app is exporting (if that is important to make them public to all other apps on the device))
On iOS I don't see how you could do it without an ANE as Adobe's API is simply CameraRoll.addBitmapData
Adobe has a CameraRollBrowseOptions class but no CameraRollSaveOptions class to support customization.
Copy link to clipboard
Copied
first make sure you have encoded bitmapdata without quality lost either use png or jpeg encoder with quality 100%
var bytes:ByteArray = new ByteArray();
bit.encode(bit.rect, flagPng ? new PNGEncoderOptions() : new JPEGEncoderOptions(100),bytes);
var file:File = File.documentsDirectory.resolvePath("DCIM/customGalleryFolder/");
if(!file.exists) file.createDirectory();
file = file.resolvePath("imgFileName.jpg");
var stream:FileStream = new FileStream();
stream.open(file, FileMode.WRITE);
stream.writeBytes(bytes);
stream.close();
Copy link to clipboard
Copied
Hi Fullflash,
I tried it your way and I can save an image on a windows PC but on Android - I cannot find a stored image and I don't get any errors.
file.nativepath ist something like "/data/data/air.com.myCompany.myApp/com.myCompany.myApp/Local Store/DCIM/customGalleryFolder"
Do you have any idea where the problem could be?
Kinde regards
Chris
Copy link to clipboard
Copied
Hi Chris,
I don't have the answer to your previous question, but when you add your image to the camera roll the old way, are you using the bitmapdata.drawWithQuality method?
Copy link to clipboard
Copied
Hi Lars,
the stageQuality in our app is high so the bitmapdata.drawWithQuality will not change anything - the compression is through the CameraRoll (see other threads)...