Posted in gimp
7006
1:16 am, June 30, 2020
 

stretching an image to fit in a banner image with gimp

sometimes i need to get a square image to fit in a rectangle box

this is a way to do it with GIMP

get a square image, or pick any image (pexels)

fit it in this box..

For this one we will be using GIMP which is a free and easy(ish) to use image editor

How to do it in GIMP

here is the video i show you how to use the transform tool to add sides to this image, code is below this on how to fit it into the banner div.

HTML

<h3>Original Image</h3>
<p>this is the original non-gimped image</p>
<div class='original-img'></div>
<h3>Original Image in Banner</h3>
<p>this is the original non-gimped image in the banner, you can see how it zooms to fit in</p>
<div class='banner-img'></div>
<h3>Gimp Stretched Image in Banner</h3>
<p>this is the gimped image in the banner, you can see how it should fit in the banner a bit nicer.</p>
<div class='new-banner-img'></div>

CSS

.original-img {
height:400px;
width:400px;
border:1px solid #000;
margin-bottom:20px;
background:url(https://i.imgur.com/xlYfwDD.jpg) center no-repeat;
background-size:cover;
}
.banner-img {
width:100%;
height:300px;
border:1px solid #000;
margin-bottom:20px;
background:url(https://i.imgur.com/xlYfwDD.jpg) center no-repeat;
background-size:cover;
}
.new-banner-img {
width:100%;
height:250px;
border:1px solid #000;
margin-bottom:20px;
background:url(https://i.imgur.com/MHIjv2m.jpg) center no-repeat;
background-size:cover;
}

Original Image

this is the original non-gimped image

Original Image in Banner

this is the original non-gimped image in the banner, you can see how it zooms to fit in

Gimp Stretched Image in Banner

this is the gimped image in the banner, you can see how it should fit in the banner a bit nicer.

View Statistics
This Week
262
This Month
845
This Year
1893

No Items Found.

Add Comment
Type in a Nick Name here
 
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
You want to be the best, you MUST put the long yards in! Nothing comes easy in life so stop wishing and start DOING! So many people would rather bitch and moan than help themselves. Dont be one of those negative drainers, start today, make a small change and keep going forwards with this attitude!
Unknown
Random CSS Property

column-span

The column-span CSS property makes it possible for an element to span across all columns when its value is set to all.
column-span css reference