I am trying to adjust the image dimensions after uploading it. Let's assume my uploaded image originally has 450x700 dimensions and its parent container has 400x400 dimensions. In my case, I use object-fit
to fit image its parent container by preserving aspect ratio and it looks like
But I need to show image fully and object-fit
is not the right option for this case. Removing object-fit
and adding width
and height
with 100%
makes it fully visible, meanwhile decreasing the quality. Here it looks like
In the last image the original image is this
UPDATED
Actually, I can solve it with object-fit: contain
, but it's not 100 percent right for me or maybe there is no other way. With contain, I get this
You can notice the white background of the image, which doesn't come well with background color of the container (which is light gray). Is there any possibility to solve it?