<img> tag with a direct link to the image source inside og-vercel shows low quality images. Help?
Unanswered
West African Lion posted this in #help-forum
West African LionOP
I have images inside my og vercel and these images are displayed in low quality/blurred. Can someone help with this?
49 Replies
Scottish Fold
if you are creating it dynamically you need to export the size
West African LionOP
i am exporting the size still the images are in low quality.
all these images are in low quality while original image is high resolution.
Scottish Fold
not sure how you are exporting, but can you do like this?
West African LionOP
I am exporting it exactly like this.
Scottish Fold
I don't see the opengraph image code
West African LionOP
example img inside my vercel og
i have dynamically exported the width and height of the whole card. I have different heights and widths for my <img /> tags on my og image.
for more context
Scottish Fold
why are you using width="50" height="50"
replace by width={size.width} height={size.height}
West African LionOP
why would i set the image width and height to whole viewport of the og image?
i have different sections i want to show inside the og image, i dont want to show only one image
Scottish Fold
oh so the issue is not only in the <img /> but all the og, got it
West African LionOP
yes
@West African Lion all these images are in low quality while original image is high resolution.
Scottish Fold
what is this you are using to test?
West African LionOP
i have different images/paragraphs tags inside my og image, and all the images i have added inside my og is blurred/low quality.
Scottish Fold
have you tried to open the og directly in your browser?
the direct link
of the og image
West African LionOP
the screenshot i sent is taken from direct link to og
this is from link to og image
is it clear now?
Scottish Fold
yes!
West African LionOP
do you understand my issue and expectation?
Scottish Fold
what is your size cost
const
West African LionOP
export const size = {
width: 800,
height: 550,
};
width: 800,
height: 550,
};
Scottish Fold
intresting, the image you sent me:
West African LionOP
i took a screenshot 😦
here is the downloaded image
please check now.
Scottish Fold
now its ok
yeah, it's like it's compressing the quality so
West African LionOP
yes
Scottish Fold
to be honest can a such low resolution to be better? not sure 800 x 550 seems not so much
because if you just see the code in browser will be better because it's not a pixeled image
West African LionOP
are you suggesting that i should not provide the size const?
and default value should be auto generated?
Scottish Fold
no, og required some standards of size actually
West African LionOP
no matter what size const i use, the quality is still reduced
does this clarify it further?
Scottish Fold
so, will not solve your problem but just a recommendation: keep it 1200 x 630, it's the standard
West African LionOP
changed it to 1200 x 630, still the image quality is low.
Scottish Fold
So, I don't see any issue on you code. Perhaps a limitation of the next.js lib used to create an image from the code.
one last question, are importing from next/og?
import { ImageResponse } from 'next/og'also, I remember of next.js asking me to install an extra lib to improve the image quality
West African LionOP
import { ImageResponse } from '@vercel/og';I am importing using vercel/og
I tried switching to next/og but same result / no difference.