When I used the Android image processing library Picasso to process the image below, it was not returned (up to cycle) in the class implementing the following transformation, and this method looped? and eventually crashed with the image size and cut position values as follows.The original image size is 640 x 480.I don't know why it happens because it's made in other images.I would appreciate it if you could tell me the cause.I look forward to your kind cooperation.
Image URL
https://i.ytimg.com/vi/RFinNxS5KN4/sddefault.jpg
Where to Use Picasso
Picasso.with (mContext)
.load (APIUtil.checkThumbnail(item))
.transform(newViewUtils.TopThumbnailEditor())
.placeholder(R.drawable.top_thumbnail_placeholder)
.fit()
.into(holder.thumbnail);
Transformation Implementation Class
private static final float THUMBNAIL_HEIGHT_DIVINER=9f/16f;
private static final float TOP_HEIGHT_DIVINER = 16f/43f;
public static class TopThumbnailEditor implements Transformation {
@ Override
public Bitmap transform (Bitmap source) {
float width = source.getWidth();
float height = source.getHeight();
float newHeight=width*THUMBNAIL_HEIGHT_DIVINER;
floatheightCutSize=(height-newHeight)/2;
newHeight=width*TOP_HEIGHT_DIVINER;
float moreHeightCutSize = newHeight/2;
Bitmap result=Bitmap.createBitmap(source,0,(int)(heightCutSize+moreHeightCutSize),(int)width,(int)newHeight);
if(result!=source)
source.recycle();
return result;
}
@ Override
public String key() {
return "TopThumbnailEditor";
}
}
Final image size, cut position, etc.
width: 1020.0
height —379.0
X coordinate cutting position: -97.375
Y coordinate cutting position: 189.76744
Other images that work well are wide images, aren't they?
private static final float THUMBNAIL_HEIGHT_DIVINER=9f/16f;
I assume that the image that comes in in is 16:9, but it gives 4:3, so negative coordinates are created, and the latter stage becomes an error and loops.
620 Uncaught (inpromise) Error on Electron: An object could not be cloned
917 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
582 PHP ssh2_scp_send fails to send files as intended
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.