473,787 Members | 2,938 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cropping Images Help Needed

Is there anyway to crop .jpg images so that they are all of the same
width and height?

I use the following math to calculate the correct aspect ratio:

width / height == aspect ratio

so if I need a 268 w x 176 h I do this:

target width 268 / aspect ration == correct height

But because my images are of various sizes to begin with, using the
above math I can get all of the images width to be 268 but because of
the correct aspect ratio needed, the heights will vary from image to
image.

I'd like to figure out how to just crop each image starting from the
top left corner and make each one 268 x 176 by cropping it - so my
question is: can I crop an image starting from 0,0 top left corner?

I know this will cause some image loss but this is acceptable since I
would be getting most of the image.

Thanks...
Jul 17 '05 #1
1 2286
Ralph Freshour <ra***@primemai l.com> writes:
I'd like to figure out how to just crop each image starting from the
top left corner and make each one 268 x 176 by cropping it - so my
question is: can I crop an image starting from 0,0 top left corner?


See the "Image functions" chapter of the PHP manual:

http://www.php.net/manual/en/ref.image.php

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1937
by: Duncan Smith | last post by:
Hello, Can anyone advise me how to crop an EPS image generated by dislin. I can't figure out how to crop the image before generating it. Using PIL to crop the generated image I get an IOError (apparently because I'm using Windows). I could use other file formats, but I'm not too keen on the results I'm getting from using e.g. .tif. Basically I need to copy (publication quality) images created in dislin and paste them into word...
13
6889
by: Jon Yeager | last post by:
I need to display a bunch of pictures that are all of various dimensions into a fixed dimension space, like MSN Messenger does with its user photos in the chat windows. Forcing image dimensions will warp the proportions, so that's no good. Forcing one coordinate while leaving the other flexible will maintain proportions, but the x,y values won't be consistant from picture to picture. I considered the MSN Messenger method of bringing...
61
4757
by: phil-news-nospam | last post by:
Why does SVG need a different tag than other images? IMHO, SVG should be implemented as an image type just like any other image type, allowing it to work with <img> tags, and ... here is the important part ... also work with backgrounds in other tags. I fail to see any wisdom in making SVG different than say PNG (of course the implementation of the rendering code would obvious be different). --
0
1957
by: AmerS | last post by:
hi, I have been trying to generate image patches for a training set but have not succeded yet. The only method i tried is cropping areas of the image and store the cropped images or patches as an array of bytes. The problem is, same patch gets stored thoughout the array, meaning its cropping the same area in the loop and the rectangle is not moving, could some one explain to me why, Thank You. heres the code: MemoryStream stream = new...
2
1786
by: kumari | last post by:
Hi, I am facing a problem with generation of thumbnail images in php. The requirement is as follows: the client would provide the image url, description, and content through a page. and the same information will be stored in database. While displaying all images i should take that url. and read it byte by byte and pass to a curl function where in it crops and echos.. the cropped version of image.
1
5684
by: jpuopolo | last post by:
All: I looked around and could not find a simple yet complete example of cropping an image in C#. I had the problem of needing to shave off the bottom-most 18 lines of a directory full of images. The following code does this. I hope that this serves as a concise yet complete example of how to tackle cropping an image. --- Note that inputDireName and outputDirName have been set in the class
2
2985
by: ykhamitkar | last post by:
Hi there, I am trying to create a game for which I need following information 1. How to add a browse button which would make user able to select an image file and then that image gets added in the flash file for the game 2. How to split (crop) these images into multiple small boxes Kindly advise Thanks
5
13382
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL http://mghospedagem.com/images/controlpanel.jpg instead of http://mghospedagem.comhttp://mghospedagem.com/images/controlpanel.jpg As u see, there's the website URL before the image URL.
3
2908
by: mcfly1204 | last post by:
I have a photo cropping tool in place that fits my needs, with one exception. When a user uploads a high res. photo, it does not fit on the screen. I have a zoom feature that allows the image to fit on the screen, but then the user is cropping the downsized image and not the original. I would like to find a way to have the cropped area on the original image correspond with the cropped area on the zoomed image. Any thoughts? I have...
0
9497
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10169
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.