Images format

Can we still have a mix of webp and jpeg images ?
99 Replies
Jochem
Jochem4w ago
yes
Vandana
Vandana4w ago
pls haave a look at this
Vandana
Vandana4w ago
GitHub
GitHub - kvandana451/Assorted-Cards-images: A card layout with vari...
A card layout with various sizes, containing images and/or text. - kvandana451/Assorted-Cards-images
Vandana
Vandana4w ago
for the card "travel and see the world " implemented clamp. but due to margin:50% auto there is a huge amt of space to align the text at the center,tried text-align:center and flex properties as well didnt work so i used the margin
Jochem
Jochem4w ago
this seems like a separate question, unrelated to image formats? if so, please make a new post
Vandana
Vandana4w ago
because of images something gets effected i felt that is why
Jochem
Jochem4w ago
you may want to remove the solved tag and change the title then, I can't look into this right now and most people probably won't open a post with the solved tag on it
Mannix
Mannix4w ago
.text-title{
display: grid;
align-items: center;
height: 100%;
}
.text-title{
display: grid;
align-items: center;
height: 100%;
}
Vandana
Vandana4w ago
works .text-title{ font-size:clamp(1rem, 5vw, 3rem); } for large screen size like 1100 and above font-size is 51px which shouldnt be it shouldnt exceed 48px right? because browser default font size is 16px.and third value in clamp function is 3rem
Mannix
Mannix4w ago
it shoudn't. are you sure you have 16px for the browser font size
Vandana
Vandana4w ago
yes sure and 5vw for screen size 1100 will be 55px
Jochem
Jochem4w ago
my viewport is 1600px wide and the computed font-size is 48px even with the 200vw which is still in the deployed version of your site did you change the font-size on ::root or html?
Vandana
Vandana4w ago
nah screen size is 1100px preferable value (second clamp value) is 5vw which is equivalent to 55px am i right here?
Jochem
Jochem4w ago
yeah though clamp would restrict it to 48 with this definition of font-size
Vandana
Vandana4w ago
yeah yeah your right as per your explaination
Vandana
Vandana4w ago
it has automatically adjusted to 17px that is why the issue
No description
Vandana
Vandana4w ago
so to conclude in this example font-size:clamp(16px,55px,48px) for screen size of 1100 has font-size 48px only am i right?? 1rem=16px 5vw=>55px screen size(1100px)
Jochem
Jochem4w ago
1rem = 1 times the font size of the root element, which by default is 16px, yes and yes, anything over the third value gets clamped to that third value, so it should never be over 48px
Vandana
Vandana4w ago
5vw=>55px screen size(1100px) this is also right calculation ?
Jochem
Jochem4w ago
1100 * 0.05 is 55, yeah
Vandana
Vandana4w ago
Thank you!!
Jochem
Jochem4w ago
no problem, glad to help!
Vandana
Vandana4w ago
images here are gigantic over here what is your suggestion ??pls go through and let me where and all i can modify and improve https://github.com/kvandana451/Assorted-Cards-images
GitHub
GitHub - kvandana451/Assorted-Cards-images: A card layout with vari...
A card layout with various sizes, containing images and/or text. - kvandana451/Assorted-Cards-images
Vandana
Vandana4w ago
pls look for the larger larger screen sizes as well
Jochem
Jochem4w ago
I'm not going to go through that all one by one, but i can give some general advice. You want the images to be of such a resolution that they're close to what they're being displayed at. If they're extra big, you may want to use the picture element with alternate image sizes. As for resizing them, you can use pretty much any photo editor including MS Paint, or an online service this is also very much a topic for a new post, these posts aren't supposed to cover more than one issue and its solution
Vandana
Vandana4w ago
ok so shall i post this as a new post? i wanted a feedback on it that is why.and what to know where am i going wrong if the images are big then we are resizing by width and height properties with relative units
Jochem
Jochem4w ago
Pretty sure you already have a code review post up in #showcase it's about balancing the filesize and resolution of the images with the size they are displayed at in the website. If you have a 15mb 4800x3600px image and you're showing it at the top of a card at 300px wide, you're wasting a ton of bandwidth
Vandana
Vandana4w ago
yeah it was asked to put over there not in HELP section unable to catch this point.. i am not showing the entire 4800*3600 on top of a card rather it will be resized accordingly by relative units say 800x400
Jochem
Jochem4w ago
The file is still a certain size, regardless of how it's displayed
Vandana
Vandana4w ago
here i cant use picture element because there are no multiple source elements that can be matched with alt img sizes. And as of now its like wasting time for using photo editor for resizing them
Jochem
Jochem4w ago
You don't want the image file that is served to the user to be much bigger than it needs to be, to save on bandwidth. That's all there is to it
Vandana
Vandana4w ago
yeah ! what can be done for this usecase now?
ἔρως
ἔρως4w ago
i recommend using squoosh.app i pointed this out as a problem because the disgusting webp format uses less data, and keeps most of the quality
ἔρως
ἔρως4w ago
on a screen with width of 3760, it shows at 805x507px
No description
ἔρως
ἔρως4w ago
on a 1080p display, it won't be much bigger than 377x252
No description
ἔρως
ἔρως4w ago
and it is a jpeg image, but the image doesn't eat much space
ἔρως
ἔρως4w ago
just converting to webp, it's ~14kb now, from ~29kb
No description
ἔρως
ἔρως4w ago
if you decide you want to resize to 50% the resolution, it's a ~5.45kb image
No description
ἔρως
ἔρως4w ago
that's 81% in savings, according to this you can use both versions and set a srcset to load the original image, for larget screens but just saving as webp, it's ~51% smaller in 2 minutes, you can generate 2 images that take up less space than the original image alone for img5, i wouldn't resize it, as the resolution is pretty close to the size it is displayed at
ἔρως
ἔρως4w ago
with some effort, i reduced the size of the image to ~104kb, with barely any perceptive loss in quality - which is about 40% smaller
No description
ἔρως
ἔρως4w ago
that's an image that's ~174kb in size
ἔρως
ἔρως4w ago
by the end, your 1.2mb website may be way less than 1mb - i predict about 800kb
No description
ἔρως
ἔρως4w ago
why is this important? well, it costs me money to see your page on my phone, it costs you money to serve the page to me (im aware of the free tier, but with enough visitors it will cost you money) https://www.reddit.com/r/webdev/comments/1b14bty/netlify_just_sent_me_a_104k_bill_for_a_simple/?rdt=59218 <-- also, remember this?
Vandana
Vandana4w ago
14kb from 511kb in my screen size ..
No description
ἔρως
ἔρως4w ago
because you copy-pasted i dragged the image when you copy the image, for some reason, it's set in the windows clipboard as png (i guess microsoft was trying to avoid bmp) when you paste, you're pasting a png, which uses a lot more space, in this type of image just drag and drop the jpeg image into the website you can drag and drop from the website directly into squoosh
Vandana
Vandana4w ago
after doing these modifications in squoosh we nedd to download the image genertaed by squoosh?
ἔρως
ἔρως4w ago
yes
Vandana
Vandana4w ago
Ah ! i understood the concept
Vandana
Vandana4w ago
why there is a divison pink and blue which result should we consider?
No description
ἔρως
ἔρως4w ago
the idea is for you to compare the result between the pink and the blue imagine you test webp vs avif or you compare webp with the original, to see if you're losing too much quality
Vandana
Vandana4w ago
your right its blurred
ἔρως
ἔρως4w ago
it is because it's 50% the size but, for this case, it's perfect
Vandana
Vandana4w ago
so this preset is 50% of the original image size right?
ἔρως
ἔρως4w ago
basically, yes but you're changing the number of colors on both, so, they aren't the exact same thing
Vandana
Vandana4w ago
ok but after getting the desired results and using srcset how will the browser know which image to select?
ἔρως
ἔρως4w ago
the window width or the height
Vandana
Vandana4w ago
the window width and height will not be provided in the srcset.
Vandana
Vandana4w ago
got it ..So this process of using photographic apps and then modifying is a time consuming process.so the designer has to provide proper image formats to avoid this extra stuff right?
ἔρως
ἔρως4w ago
nah, you automate it in a build set or use tools to do this in a bulk way ive seen amazing designers struggle really hard to resize images, so, i don't trust a designer to do that work
Vandana
Vandana4w ago
this is new to me
ἔρως
ἔρως4w ago
i know
Vandana
Vandana4w ago
I understood this process
ἔρως
ἔρως4w ago
but you only have to do 15 imges, so, it doesn't take long in 15 minutes you're done depending on the image it isn't worth it to spend 5-6 hours automating something you can do in 15 minutes (YES, I SAID IT! bring out the pitchforks!)
Vandana
Vandana4w ago
So in real time apps developers are doing this bulky way using graphic tools??
ἔρως
ἔρως4w ago
i wouldn't call imagemagick a "graphic tool" but depending on the situation, yes some CRMs do this automatically, like wordpress
Vandana
Vandana4w ago
ohh! Thanks for explaining and responding pin to pin and making me understand this concept
ἔρως
ἔρως4w ago
you're welcome any more questions about this?
Vandana
Vandana4w ago
nah will implement the same and get back on this!
ἔρως
ἔρως4w ago
good luck it shouldn't be too hard to do this i did it 2 images in less than 5 minutes, but i was kinda distracted
Vandana
Vandana4w ago
yes Thank you so much once again for sharing knowledge!! Thanks everyone who helped me in this post !!!Iit was a great learning experience .Thank you all
ἔρως
ἔρως4w ago
you're welcome if you have any questions, regarding this topic, just ask here
Vandana
Vandana4w ago
Yup..
ἔρως
ἔρως4w ago
so, any questions?
Vandana
Vandana4w ago
Ill get back in a while
ἔρως
ἔρως4w ago
alright
Vandana
Vandana4w ago
1080p display 283x189
No description
Vandana
Vandana4w ago
I have a doubt i implementing the above scenario though i have understood the concept . Intrinsic size of the image will always be the same even after reducing the file-size?
ἔρως
ἔρως4w ago
intrinsic size is the size that the image has it's the original resolution
Vandana
Vandana4w ago
So after using photographic app the downloaded img has different intrinsic size am i right?? First of all thanks for responding.
ἔρως
ἔρως4w ago
this is a big "depends" if you resize, yes. if you don't resize, no think of intrisic size as the size that the image would have if you just put it in an html file, without setting any size in html or css
Vandana
Vandana4w ago
As we were trying the day before regarding the above process kindly see line no:37 implementing srcset
Vandana
Vandana4w ago
No description
ἔρως
ἔρως4w ago
generally, i would say to make a new post but this doesn't work /images/download (2).webp 375w, /images/img3.webp 1125w <-- the spaces will be interpreted as not being part of the url at least call it img3-375.webp
Vandana
Vandana4w ago
can we continue in this its a request because everything is explained well leads to confusion that is why.
ἔρως
ἔρως4w ago
i already answered
Vandana
Vandana4w ago
No description
Vandana
Vandana4w ago
look at the current src its not taking img3-375.webp for a size less than 639 px
ἔρως
ἔρως4w ago
this is the point where it starts to go very off topic
Vandana
Vandana4w ago
should i make a new post now?
ἔρως
ἔρως4w ago
try checking the network tab, and see if the image is being loaded or not if it isn't, make a new post
Vandana
Vandana4w ago
No description
Vandana
Vandana4w ago
nah
ἔρως
ἔρως4w ago
refresh with it open
Vandana
Vandana4w ago
img3-375.webp isnt there
ἔρως
ἔρως4w ago
then yeah, it's best to ask in another post
Vandana
Vandana4w ago
i need to explain everything from the beginning like i used graphic tools etc etc etc
ἔρως
ἔρως4w ago
no, just that the srcset isn't working, and where we can test it
Vandana
Vandana4w ago
okay. I have posted and i guess there is no response still could you pls go through it.
Want results from more Discord servers?
Add your server
More Posts