React Native Image resizeMode vs resizeMethod - image

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

Related

Xamarin - How to create a layout that will adjust its size across all devices while maintaining its ratio

I am essentially creating a trading card that must maintain a 2.5x3.5 ratio.
I created the cards background image (with logo's and things that will never change)
I need to create a layout/frame/whatever that will maintain a 2.5x3.5 ratio so I can give it this background image (or image aspectfit) that will never stretch, given that the layouts aspect ratio should never change. This way no matter the size of a phones screen, the height and width size will adjust to fit in any size screen, but the view's aspect will always remain in tact...
The idea is, I will then place labels into this card through Xamarin forms using an API. Name, image, details, etc...
The image of the cards logos will never change, hence the background image, but the labels will change according to character...
Any ideas?

Resize image from file to the right aspect ratio vb6

I searched about re-sizing images all over the place and they all use picturebox and Image control trying to fit an image inside it without distortion of the image.
In my case I have an image of 2048X900 of size but the image is stretched in width I need to read it from a file, repair it by changing the aspect ratio of the image, and store it back. I leaned I can't do directly on the image and some use control to do all this steps.
Any suggestion of I have to use a control to change the ratio of an image
thanks
When you choose to resize an image into a different aspect ratio than the original's, you'll need to decide how you'd like that to happen. There are various ways, like stretching (as you already mentioned), padding (resizing the image and filling the padding with whitespaces or anything else), or cropping the image (which means that you'll need to choose which parts of the images remain visible and which ones don't).
There are quite a few of ways to perform such image resizing, either locally with a software or using cloud services.
For example, with Cloudinary you can upload an image and resize it to any dimensions you'd like, including altering the aspect ratio. Everything is done seamlessly on the fly and in the cloud.
For more information:
http://cloudinary.com/documentation/image_transformations#aspect_ratio_based_cropping
Disclosure - I work at Cloudinary.

images are randomly blurry

I can't figure out why some images get blurry at different browser sizes. Take a look at this sample site:
The menu buttons at the top and the other buttons all shrink a bit when hovered over. Change the browser size a few times and see that some of them are blurry. Some actually get sharper when hovered over, some get blurrier.
I can't figure out how to solve this. They are all compressed the same way, all around the same resolution. Is there a specific size that they need to be to look better when scaled?
You are serving your image files way too large, causing the browser to spend time rescaling them to the size specified in the image tag. This causes the two-pass rendering that you are seeing.
For example, icon_profile2.png has the dimensions 2055x1712.
Resize your images to the desired size in your favorite image editor and use the scaled-down version on the website.

photoshop to flash size trim

I've imported many clips from photoshop into flash and animated them. they are still editable by photoshop though.
Now i realized that the clips are much larger size than i require on runtime. Which leads to my first question :-
Does their original size effect the performance, if i am scaling them half on the rumtime?
And, if it does is there anyway i can shorten the size originally, given that i've already animated them?
Right clicking the image to edit it with photoshop, that does not work because we cant change size there.
It probably does affect performance, but how noticable it is depends on their size and on how many of them are being scaled at the same time. What you do with them during runtime could also affect this.
You can change the size in Photoshop, but it means you will have to enlarge the image again in Flash, since any transformations like scaling will remain after resizing the image in Photoshop.

Bootstrap and images: What are the best dimensions to pre-resized images for a design implemented with Bootstrap?

I'm using a CMS (read: WordPress). While I realize that Bootstrap will adjust img sizing on the fly, should I (for example) have WP create a version of an image for each BS span# width? Or do you think having span2, span4, span6, etc. would be close enough and just just the slightly larger image for the next span down. For example, if you need an image in a span1, would you simply use the span2 image?
I'm trying to balance image size against being practical and reasonable.
Perhaps this isn't a StackoverFlow question? My apologizes.
Well, there are no such limitations or ideal sizes. People can use larger than 1000px width images or lower than 50px as well. It is the beauty of bootstrap, it automatically resizes image if the span width is smaller than image width.
So that should not really bother us while developing the theme. One thing you can take care of is, measure the most used span's width in Web developers tool and set ideal image size little smaller than span width.
You don't need another function to resize images. It would be an overkill.

Resources