-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from spoonconsulting/replace-android-compressor
bitmap compression
- Loading branch information
Showing
8 changed files
with
333 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.spoon.spectrum; | ||
|
||
import androidx.camera.core.impl.utils.Exif; | ||
import androidx.exifinterface.media.ExifInterface; | ||
|
||
public class SpoonCameraExif { | ||
public static final String[] COMMON_TAGS = { | ||
ExifInterface.TAG_MAKE, | ||
ExifInterface.TAG_MODEL, | ||
ExifInterface.TAG_DATETIME, | ||
ExifInterface.TAG_ORIENTATION, | ||
ExifInterface.TAG_GPS_LATITUDE, | ||
ExifInterface.TAG_GPS_LONGITUDE, | ||
ExifInterface.TAG_GPS_ALTITUDE, | ||
ExifInterface.TAG_IMAGE_WIDTH, | ||
ExifInterface.TAG_IMAGE_LENGTH, | ||
ExifInterface.TAG_EXPOSURE_TIME, | ||
ExifInterface.TAG_APERTURE_VALUE, | ||
ExifInterface.TAG_FOCAL_LENGTH, | ||
ExifInterface.TAG_WHITE_BALANCE, | ||
ExifInterface.TAG_FLASH, | ||
ExifInterface.TAG_SOFTWARE, | ||
ExifInterface.TAG_Y_CB_CR_POSITIONING, | ||
ExifInterface.TAG_X_RESOLUTION, | ||
ExifInterface.TAG_Y_RESOLUTION, | ||
ExifInterface.TAG_RESOLUTION_UNIT, | ||
ExifInterface.TAG_F_NUMBER, | ||
ExifInterface.TAG_EXPOSURE_PROGRAM, | ||
ExifInterface.TAG_RW2_ISO, | ||
ExifInterface.TAG_EXIF_VERSION, | ||
ExifInterface.TAG_DATETIME_ORIGINAL, | ||
ExifInterface.TAG_OFFSET_TIME, | ||
ExifInterface.TAG_OFFSET_TIME_ORIGINAL, | ||
ExifInterface.TAG_OFFSET_TIME_DIGITIZED, | ||
ExifInterface.TAG_SHUTTER_SPEED_VALUE, | ||
ExifInterface.TAG_BRIGHTNESS_VALUE, | ||
ExifInterface.TAG_MAX_APERTURE_VALUE, | ||
ExifInterface.TAG_METERING_MODE, | ||
ExifInterface.TAG_FLASHPIX_VERSION, | ||
ExifInterface.TAG_COMPONENTS_CONFIGURATION, | ||
ExifInterface.TAG_SUBSEC_TIME, | ||
ExifInterface.TAG_SUBSEC_TIME_ORIGINAL, | ||
ExifInterface.TAG_SUBSEC_TIME_DIGITIZED, | ||
ExifInterface.TAG_COLOR_SPACE, | ||
ExifInterface.TAG_SCENE_TYPE, | ||
ExifInterface.TAG_CUSTOM_RENDERED, | ||
ExifInterface.TAG_EXPOSURE_MODE, | ||
ExifInterface.TAG_DIGITAL_ZOOM_RATIO, | ||
ExifInterface.TAG_FOCAL_LENGTH_IN_35MM_FILM, | ||
"FocalLengthIn35mmFormat", | ||
ExifInterface.TAG_SCENE_CAPTURE_TYPE, | ||
ExifInterface.TAG_CONTRAST, | ||
ExifInterface.TAG_SATURATION, | ||
ExifInterface.TAG_SHARPNESS, | ||
ExifInterface.TAG_IMAGE_UNIQUE_ID, | ||
ExifInterface.TAG_GPS_VERSION_ID, | ||
ExifInterface.TAG_GPS_LATITUDE_REF, | ||
ExifInterface.TAG_GPS_LONGITUDE_REF, | ||
ExifInterface.TAG_GPS_ALTITUDE_REF, | ||
ExifInterface.TAG_GPS_DATESTAMP, | ||
ExifInterface.TAG_GPS_TIMESTAMP, | ||
ExifInterface.TAG_GPS_PROCESSING_METHOD, | ||
"latitude", | ||
"longitude", | ||
"ModifyDate", | ||
"CreateDate", | ||
"ExposureCompensation", | ||
"ExifImageWidth", | ||
"ExifImageHeight" | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.spoon.spectrum.utils; | ||
/* | ||
* Copyright (c) 2004-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the LICENSE | ||
* file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
import static java.lang.annotation.RetentionPolicy.CLASS; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Add this annotation to a class, method, or field to instruct Proguard to not strip it out. | ||
* | ||
* <p>This is useful for methods called via reflection that could appear as unused to Proguard. | ||
*/ | ||
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR}) | ||
@Retention(CLASS) | ||
public @interface DoNotStrip {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package com.spoon.spectrum.utils; | ||
|
||
import javax.annotation.concurrent.Immutable; | ||
|
||
/** Represents a rectangular area defined by its width and height. */ | ||
@DoNotStrip | ||
@Immutable | ||
public class ImageSize { | ||
|
||
/** | ||
* Setting to 2**16 as this is the smallest common denominator for all common image libraries that | ||
* we are interested in. | ||
*/ | ||
@DoNotStrip static final int MAX_IMAGE_SIDE_DIMENSION = 65536; | ||
|
||
/** The size's width. */ | ||
@DoNotStrip public final int width; | ||
|
||
/** The size's height. */ | ||
@DoNotStrip public final int height; | ||
|
||
/** | ||
* Creates a new {@link ImageSize} | ||
* | ||
* @param width Must be within [0, {@link #MAX_IMAGE_SIDE_DIMENSION}] | ||
* @param height Must be within [0, {@link #MAX_IMAGE_SIDE_DIMENSION}] | ||
*/ | ||
@DoNotStrip | ||
public ImageSize(final int width, final int height) { | ||
Preconditions.checkArgument(width >= 0 && width <= MAX_IMAGE_SIDE_DIMENSION); | ||
Preconditions.checkArgument(height >= 0 && height <= MAX_IMAGE_SIDE_DIMENSION); | ||
this.width = width; | ||
this.height = height; | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
final ImageSize that = (ImageSize) o; | ||
return width == that.width && height == that.height; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = width; | ||
result = 31 * result + height; | ||
return result; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ImageSize{" + "width=" + width + ", height=" + height + '}'; | ||
} | ||
} |
Oops, something went wrong.