How do I get the original bitmap with fresco? - fresco

When I load a long image, the ratio of 400x4000, I get bitmap with onNewResultImpl(#Nullable Bitmap bitmap),but the bitmap quality is too low, I just want to get the full bitmap, not display in DraweeView,how can I do?

I suppose you have downsampling or resizing enabled. You have to disable these options in order for you to get the original bitmap. However, some devices are not able to decode bitmaps that are too large, so this will not work on all devices.

Related

how image size and resolution correlate in JPEG format

I have a photo with a size and pixel diemensions as shown below:
I opened and saved it using Matlab, and the size of this photo becomes much smaller, and also a smaller dpi value. But the diemension is still the same.
Then I converted the two to .bmp format, and the bmp images are in the same size! Does the dpi value correlate to image size, or there are other reasons behind?
When an image is described as 7952× 5304 pixels, then the dpi value is of no consequence. It means nothing.
Where the dpi value comes in, is in describing how large the image will be printed.
You can always resize the image to the dimensions you want with imresize.

React Native Image resizeMode vs resizeMethod

I'm currently using RN 41.2 and I have questions about resizing images from a url. The url files can get quite large, usually around 2000x2000 and I want to display them way smaller probably around 25x25.
Is there an equivalent iOS Image prop for the 'android only' resizeMethod?
When resizeMethod='resize' it changes the size of the large encoded image before it is decoded and so the images display almost immediately in the smaller size and it's great.
But for iOS I'm using resizeMode (contain, cover, etc) and it displays the image correctly but it always takes a bit of time for the images to actually appear, which is totally understandable it's just annoying.
Am I missing something here? It seems like resizeMode should do the same thing the resizeMethod does but it clearly does not
resize mode property decides how the RAW image should be fit inside its frame (cover, contain, stretch, center, repeat)
refer https://reactnative.dev/docs/image#resizemode
In addition for android we can choose the mechanism that should be used to resize image that is to scale , resize or auto using resizeMethod prop.
refer https://reactnative.dev/docs/image#resizemethod-android
basically resizeMode instructs how to resize the image and resizemethod defines what mechanism to use for resizing
This is provided as there exists some issues in android when the frame size and RAW image size varies significantly (too large image: too small frame or too small image and too large frame) and there can be significant delays or design breaks while rendering as auto selection of resize mechanism isnt optimal.
You can escape without setting resizeMethod manually (defaults to auto) most times but it causes issues in before mentioned scenarios.
resizeMode and resizeMethod are 2 properties that the Image component has in RN.
resizeMode: Determines how to resize the image when the frame doesn't match the raw image dimensions.
It can take cover, contain, stretch as values.
resizeMethod: It can be used to resize the image when the image's dimensions differ from the image view's dimensions.
It can take auto, resize, scale as values.
For more you can refer https://facebook.github.io/react-native/docs/image.html

Why should I resize an image in Coldfusion if the file size doen't decrease and the quality of the image suffers?

Just wondering:
I'm trying to set up an adaptive image handler in Coldfusion8, which resizes images for smaller screensizes.
I have it working allright and am currently playing around with the different resize options found here
What I notice is no matter what method I'm using, they all take time, reduce the image quality and not really reduce the image size, so for example:
IMG 1 IMG 2
Original 23K 900x360px 53K 900x360px
Blackman 22k 320x128px 52K 320x128px
highPerformance 21K 320x128px 32K 320x128px
nearest 25K " 38K "
The idea was to resize images for smaller displays. Right now I'm not really reducing anything, I'm only drainging the processor for resizing and output blurry images and the same file size.
Question:
Why should I bother resizing then? I might as well send the original file which #900x360px #23K. At least that images will be sharp vs. a resized blurry image with 320x1280px. Is there a way to make resizing images in Coldfusion worthwhile in terms of file size and/or image quality?
Thanks for inputs!Cldfu
I think what you fiddle with are quality/speed of the resize algorithm, not compression.
To compress with better file size, set the JPEG compression quality using the quality attribute (default to 0.75)
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7945.html
If cfimage doesn't satisfy your needs, use imagemagick

Image format to put inside PDF's to have fast rendering

I would like to know which image format inside PDF's is rendered fastest. I tested mupdf code and I figured out that image decoding takes an important part in rendering time. So I would like to know if there are image formats that would not impact very much on cpu load.
I dont think this is really a question of what is best simply within PDFs, however:
As a general rule, I have always found that pre-rendering the image's size to the actual size you wish to present on screen is the best way to get both size and rendering speed to what you want them to be. Simply dragging an image into a document doesnt bring the pixel count (thus size) down as most document types simply put a display size tag around the full image. This causes the display program to have to real-time resize the image for display. The less the display program has to real-time resize the image the faster it will display.
As for file types:
Bitmaps are generally considered the fastest to display as they (for the most part) are copy and paste the color for each pixel onto the screen pixel. They are generally considered the biggest file. Depending on your images, if they aren't noisy (have a lot of solid runs of the same color) then they can be RLE encoded. I have seen many RLE encoded images that are indeed even smaller than JPEG images, but it is very situational.
JPEGs tend to be the smallest for transfer and also generally display decently quick. As an opinion they are also the lowest quality images (look close, if you started with a perfectly clean image, JPEG compression will add noise to it unless using lossless compression)
PNGs tend to be my favorite. They can be lossless compressed, can be fairly small if using flattened PNGs (i.e. NOT ADOBE FIREWORKS PNGs) and do produce crisp images that render fairly quickly.
So to sum up: I would probably recommend flattened PNGs that have been pre-sized and saved to the size you wish to display on screen.

File format limits in pixel size for png images?

Is there a file format limit to the PNG pixel size?
I am trying to visualize a 30.000x30.000 pixels PNG image with Firefox, but I get an error. The image opens correcly in Preview.app, although very slowly. The file size is not big, just around 3 MiB (1 bit black/white image). I am wondering if there's a technical file-format reason for this.
A naive implementation of resizing would require the image to be blown up to 2.7GB in size before it is displayed. This would clearly be too large for a normal 32-bit program to handle.
The PNG specification doesn't appear to place any limits on the width and height of an image; these are 4 byte unsigned integers, which could be up to 4294967295. http://www.libpng.org/pub/png/spec/iso/index-object.html#11IHDR
That is an odd image, but I am sure there is a reason to have such a huge image.
I can't really address the size limit, but I can address a way to get around it. Create a set of tiles of some size, and then as the user scrolls, bring tiles into view using CSS to position them correctly. You might even be able to get away with bringing up all the tiles at once, with a slew of smaller images.
But I am curious, what is the application that needs such a huge image displayed without scaling out?
Erick

Resources