Images format

Can we still have a mix of webp and jpeg images ?
99 Replies
Jochem
Jochem6mo ago
yes
Vandana
VandanaOP6mo ago
pls haave a look at this
Vandana
VandanaOP6mo 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
VandanaOP6mo 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
Jochem6mo ago
this seems like a separate question, unrelated to image formats? if so, please make a new post
Vandana
VandanaOP6mo ago
because of images something gets effected i felt that is why
Jochem
Jochem6mo 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
Mannix6mo ago
.text-title{
display: grid;
align-items: center;
height: 100%;
}
.text-title{
display: grid;
align-items: center;
height: 100%;
}
Vandana
VandanaOP6mo 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
Mannix6mo ago
it shoudn't. are you sure you have 16px for the browser font size
Vandana
VandanaOP6mo ago
yes sure and 5vw for screen size 1100 will be 55px
Jochem
Jochem6mo 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
VandanaOP6mo ago
nah screen size is 1100px preferable value (second clamp value) is 5vw which is equivalent to 55px am i right here?
Jochem
Jochem6mo ago
yeah though clamp would restrict it to 48 with this definition of font-size
Vandana
VandanaOP6mo ago
yeah yeah your right as per your explaination
Vandana
VandanaOP6mo ago
it has automatically adjusted to 17px that is why the issue
No description
Vandana
VandanaOP6mo 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
Jochem6mo 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
VandanaOP6mo ago
5vw=>55px screen size(1100px) this is also right calculation ?
Jochem
Jochem6mo ago
1100 * 0.05 is 55, yeah
Vandana
VandanaOP6mo ago
Thank you!!
Jochem
Jochem6mo ago
no problem, glad to help!
Vandana
VandanaOP6mo 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
VandanaOP6mo ago
pls look for the larger larger screen sizes as well
Jochem
Jochem6mo 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
VandanaOP6mo 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
Jochem6mo 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
VandanaOP6mo 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
Jochem6mo ago
The file is still a certain size, regardless of how it's displayed
Vandana
VandanaOP6mo 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
Jochem6mo 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
VandanaOP6mo ago
yeah ! what can be done for this usecase now?
ἔρως
ἔρως6mo 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
ἔρως
ἔρως6mo ago
on a screen with width of 3760, it shows at 805x507px
No description
ἔρως
ἔρως6mo ago
on a 1080p display, it won't be much bigger than 377x252
No description
ἔρως
ἔρως6mo ago
and it is a jpeg image, but the image doesn't eat much space
ἔρως
ἔρως6mo ago
just converting to webp, it's ~14kb now, from ~29kb
No description
ἔρως
ἔρως6mo ago
if you decide you want to resize to 50% the resolution, it's a ~5.45kb image
No description
ἔρως
ἔρως6mo 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
ἔρως
ἔρως6mo 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
ἔρως
ἔρως6mo ago
that's an image that's ~174kb in size
ἔρως
ἔρως6mo ago
by the end, your 1.2mb website may be way less than 1mb - i predict about 800kb
No description
ἔρως
ἔρως6mo 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
VandanaOP6mo ago
14kb from 511kb in my screen size ..
No description
ἔρως
ἔρως6mo 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
VandanaOP6mo ago
after doing these modifications in squoosh we nedd to download the image genertaed by squoosh?
ἔρως
ἔρως6mo ago
yes
Vandana
VandanaOP6mo ago
Ah ! i understood the concept
Vandana
VandanaOP6mo ago
why there is a divison pink and blue which result should we consider?
No description
ἔρως
ἔρως6mo 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
VandanaOP6mo ago
your right its blurred
ἔρως
ἔρως6mo ago
it is because it's 50% the size but, for this case, it's perfect
Vandana
VandanaOP6mo ago
so this preset is 50% of the original image size right?
ἔρως
ἔρως6mo ago
basically, yes but you're changing the number of colors on both, so, they aren't the exact same thing
Vandana
VandanaOP6mo ago
ok but after getting the desired results and using srcset how will the browser know which image to select?
ἔρως
ἔρως6mo ago
the window width or the height
Vandana
VandanaOP6mo ago
the window width and height will not be provided in the srcset.
Vandana
VandanaOP6mo 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?
ἔρως
ἔρως6mo 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
VandanaOP6mo ago
this is new to me
ἔρως
ἔρως6mo ago
i know
Vandana
VandanaOP6mo ago
I understood this process
ἔρως
ἔρως6mo 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
VandanaOP6mo ago
So in real time apps developers are doing this bulky way using graphic tools??
ἔρως
ἔρως6mo ago
i wouldn't call imagemagick a "graphic tool" but depending on the situation, yes some CRMs do this automatically, like wordpress
Vandana
VandanaOP6mo ago
ohh! Thanks for explaining and responding pin to pin and making me understand this concept
ἔρως
ἔρως6mo ago
you're welcome any more questions about this?
Vandana
VandanaOP6mo ago
nah will implement the same and get back on this!
ἔρως
ἔρως6mo 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
VandanaOP6mo 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
ἔρως
ἔρως6mo ago
you're welcome if you have any questions, regarding this topic, just ask here
Vandana
VandanaOP6mo ago
Yup..
ἔρως
ἔρως6mo ago
so, any questions?
Vandana
VandanaOP6mo ago
Ill get back in a while
ἔρως
ἔρως6mo ago
alright
Vandana
VandanaOP6mo ago
1080p display 283x189
No description
Vandana
VandanaOP6mo 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?
ἔρως
ἔρως6mo ago
intrinsic size is the size that the image has it's the original resolution
Vandana
VandanaOP6mo ago
So after using photographic app the downloaded img has different intrinsic size am i right?? First of all thanks for responding.
ἔρως
ἔρως6mo 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
VandanaOP6mo ago
As we were trying the day before regarding the above process kindly see line no:37 implementing srcset
Vandana
VandanaOP6mo ago
No description
ἔρως
ἔρως6mo 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
VandanaOP6mo ago
can we continue in this its a request because everything is explained well leads to confusion that is why.
ἔρως
ἔρως6mo ago
i already answered
Vandana
VandanaOP6mo ago
No description
Vandana
VandanaOP6mo ago
look at the current src its not taking img3-375.webp for a size less than 639 px
ἔρως
ἔρως6mo ago
this is the point where it starts to go very off topic
Vandana
VandanaOP6mo ago
should i make a new post now?
ἔρως
ἔρως6mo 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
VandanaOP6mo ago
No description
Vandana
VandanaOP6mo ago
nah
ἔρως
ἔρως6mo ago
refresh with it open
Vandana
VandanaOP6mo ago
img3-375.webp isnt there
ἔρως
ἔρως6mo ago
then yeah, it's best to ask in another post
Vandana
VandanaOP6mo ago
i need to explain everything from the beginning like i used graphic tools etc etc etc
ἔρως
ἔρως6mo ago
no, just that the srcset isn't working, and where we can test it
Vandana
VandanaOP6mo 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