I have this code to launch the adobe creative SDK image editor.
Uri imageUri = Uri.parse(path);
Intent imageEditorIntent = new AdobeImageIntent.Builder(this)
.setData(imageUri)
.build();
startActivityForResult(imageEditorIntent, 1);
I want the edited image be in highest quality.
What Intent parameters be passed for that ? Or any other workaround ?
Example from the Image Editor guide
You can set the image quality with the Image Editor's optional methods. Here is an example from the Creative SDK's Image Editor guide:
Intent imageEditorIntent = new AdobeImageIntent.Builder(this)
.setData(uri) // input image source
.withOutput(Uri.parse("file://" + getFilesDir() + "/my-pic-name.jpg")) // output file destination
.withOutputFormat(Bitmap.CompressFormat.JPEG) // output format
.withOutputSize(MegaPixels.Mp5) // output size
.withOutputQuality(90) // output quality
.build();
In your case, you might mostly be interested in .withOutputSize() and .withOutputQuality().
Relevant optional methods
From the Image Editor guide:
.withOutputSize(MegaPixels)
Sets the output file size (in megapixels).
If this method is not called, or a value of 0 is passed, then the preview sized image will be returned (usually the screen size of the device).
Note: you can pass in any value from the Creative SDK's MegaPixels enum, Mp0 to Mp30.
.withOutputQuality(int)
If the outputformat is JPEG, defines the quality of the saved JPEG image.
Note: for maximum quality, pass in 100.
Documentation for all optional methods
For details on the methods above and all other optional methods, you can refer to this section of the Creative SDK Image Editor guide.
Related
I need to show all panorama photo in Gallery android. But it extension is jpg same regular photo.
How can I check a photo in Gallery android is Panorama photo?
Thanks
You'll need to extract the XMP Metadata
XMP Metadata is essentically image metadata...
...encoded in some XML-friendly format, such as Base64.
See this previous question/answers on StackOverflow to see how to decode Base64.
Based on the xml you can decode from the jpeg, you may be able to guess the intent-filter you'll need. In the case of a photo sphere panorama format for instance, this is the format.
If you want to accept Photo Sphere images in your own Android apps,
you can add the custom MIME type
application/vnd.google.panorama360+jpg to the relevant IntentFilter in
your app.
However, I'm not sure what type of panorama your jpeg is in. It may help if you posted the particular jpeg with your question.
Ask the mediadatabase through a filter condition
Where ((height/width > 2) or (width/height >= 2))
something like this
ContentResolver resolver = context.getContentResolver();
Cursor query = resolver.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
sqlSelectColums, '((height/width > 2) or (width/height >= 2))',
null, sqlSortOrder);
I'm developing an application that takes a photo and saves it in Android/data/package/files. I would like to reduce storage used, so I would like to resize the photo before saving it. For the moment I'm calling new intent passing as extra the output path. Is possible to pass also the size wanted or is possible to have the bitmap before saving it?
public void takePicture(View view){
Intent pictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File f = new File(getPath(nameEdit.getText().toString()));
path = f.getAbsolutePath();
pictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
if (pictureIntent.resolveActivity(getPackageManager())!=null){
startActivityForResult(pictureIntent,REQUEST_IMAGE_CAPTURE);
}
}
Is possible to pass also the size wanted
No.
is possible to have the bitmap before saving it?
Not really. You could write your own ContentProvider and use a Uri for that, rather than a file. When the camera app tries saving the content, you would get that information in memory first. However, you will then crash with an OutOfMemoryError, as you will not have enough heap space to hold a full-resolution photo, in all likelihood.
You can use BitmapFactory with inSampleSize set in the BitmapFactory.Options to read in the file once it has been written by the camera, save the resized image as you see fit, then delete the full-resolution image. Or, skip EXTRA_OUTPUT, and you will get a thumbnail image returned to you, obtained by calling getExtra("data") on the Intent passed into onHandleIntent().
I am using Aviary, but when i open any image in Aviary then it creates an cache image path.
I am passing my own image path but still it creates their new path (WITH CACHE IMAGE).
Any suggestions on this.
Thanks in Advance.
The Creative SDK Image Editor (formerly Aviary) will do this if you use an http Uri as the location of your original image when you call .setData().
As noted in the Methods section of the Creative SDK Image Editor guide, for the .setData() method:
.setData()
Sets the input image Uri.
Supported schemes are:
scheme_file (e.g. file://mnt/sdcard/download/image.jpg)
scheme_content (e.g. content://media/external/images/media/112232)
Note: http will work for low-resolution editing only, but it is not a feature that we currently support.
Part of http Uri's not being a supported is that the saved image is lower quality and the output Uri is set by the Image Editor.
I need to show all panorama photo in Gallery android. But it extension is jpg same regular photo.
How can I check a photo in Gallery android is Panorama photo?
Thanks
You'll need to extract the XMP Metadata
XMP Metadata is essentically image metadata...
...encoded in some XML-friendly format, such as Base64.
See this previous question/answers on StackOverflow to see how to decode Base64.
Based on the xml you can decode from the jpeg, you may be able to guess the intent-filter you'll need. In the case of a photo sphere panorama format for instance, this is the format.
If you want to accept Photo Sphere images in your own Android apps,
you can add the custom MIME type
application/vnd.google.panorama360+jpg to the relevant IntentFilter in
your app.
However, I'm not sure what type of panorama your jpeg is in. It may help if you posted the particular jpeg with your question.
Ask the mediadatabase through a filter condition
Where ((height/width > 2) or (width/height >= 2))
something like this
ContentResolver resolver = context.getContentResolver();
Cursor query = resolver.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
sqlSelectColums, '((height/width > 2) or (width/height >= 2))',
null, sqlSortOrder);
I'm using Creative SDK as photo editor of my selfie app. According to SDK Document, I wrote following code to send an photo to Editor activity.
Uri uri = Uri.fromFile(fileImg);
//set preview size
DisplayMetrics dm = DeviceUtils.getDisplayMetrics();
int max_size = Math.max(dm.widthPixels, dm.heightPixels);
max_size = (int) ((float) max_size / 1.2f);
//prepare
Intent newIntent = new AviaryIntent.Builder(fromAct).setData(uri)
.withOutput(uri)
.withOutputFormat(Bitmap.CompressFormat.JPEG)
.withOutputSize(MegaPixels.Mp5).withNoExitConfirmation(true)
.saveWithNoChanges(false)
.withOutputQuality(100)
.withPreviewSize(max_size)
.build();
// ..and start feather
fromAct.startActivityForResult(newIntent, ACTION_REQUEST_FEATHER);
In Aviary Editor activity, the preview image is too small on HTC device(HTC One M8). It works properly on another device(with full size).
How could I solve it?
A small image loaded on screen depends on different factors:
the passed withPreviewSize(max_size) is smaller than the screen size.
the image itself is smaller than the screen size.
in your case what is the value of max_size? Try to omit that parameter (the editor activity will try to load the image using an optimal resolution).
Secondly, Are you sure the image you're trying to load is big enough? Try to load that image in your activity and print out the bitmap width and height.
So, working well for me with:
.withOutputQuality(100)
.withPreviewSize(2000)