This repository was archived by the owner on Jan 7, 2023. It is now read-only.
Using createScaledBitmap, using a scaled matrix and calling createBit…#226
Open
blinkmacalahan wants to merge 1 commit intojdamcd:masterfrom
Open
Using createScaledBitmap, using a scaled matrix and calling createBit…#226blinkmacalahan wants to merge 1 commit intojdamcd:masterfrom
blinkmacalahan wants to merge 1 commit intojdamcd:masterfrom
Conversation
…map, and other methods involving scale always caused bad looking images. Using inSampleSize while decoding resulted in much better looking images. The only downside to using it is that you cannot get an exact dimension. This is because isSampleSize must be a power of 2. So if you aren't picky about the exact dimension of your final scaled image and want better quality, you can use withScaleMethod and specify BETTER_QUALITY_BEST_FIT. The default uses the traditional method.
|
How did you get around travis? i keep getting lint errors |
Author
|
@Lawgrin, um I don't know. I made a fork a few hours ago and made my code changes, committed, and then creating a pull request. Nothing special. |
|
@blinkmacalahan OK i obviously made to many changes on mine for it to just take it. Thnx |
| matrix.postScale((float) outWidth / rect.width(), (float) outHeight / rect.height()); | ||
| croppedImage = Bitmap.createBitmap(croppedImage, 0, 0, croppedImage.getWidth(), croppedImage.getHeight(), matrix, true); | ||
| BitmapFactory.Options options = new BitmapFactory.Options(); | ||
| if ((rect.width() > outWidth || rect.height() > outHeight)) { |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…map, and other methods involving scale always caused bad looking images. Using inSampleSize while decoding resulted in much better looking images. The only downside to using it is that you cannot get an exact dimension. This is because isSampleSize must be a power of 2. So if you aren't picky about the exact dimension of your final scaled image and want better quality, you can use withScaleMethod and specify BETTER_QUALITY_BEST_FIT. The default uses the traditional method.
I've attached two files. The file called matrixScaled.jpg is done with what the library originally does and sampleSizeDecoding.jpg in an image using my proposed code.

