• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Converting JPEG Image Greater Than 72dpi To 72dpi (SOLVED)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting JPEG Image Greater Than 72dpi To 72dpi (SOLVED)


  • Subject: Re: Converting JPEG Image Greater Than 72dpi To 72dpi (SOLVED)
  • From: Ian was here <email@hidden>
  • Date: Thu, 25 Aug 2005 11:54:27 -0700 (PDT)

Gentlemen, with your help I accomplished my goal.
Thank you! Here is the code:



+ (NSImage *)loadImageUsingFileName:(NSString *)fName
{
	NSImageRep			*imageRep = [NSImageRep
imageRepWithContentsOfFile:fName];
	float				niWidth = (float)[imageRep pixelsWide];
	float				niHeight = (float)[imageRep pixelsHigh];
	NSImage				*newImage = [[[NSImage alloc]
initWithSize:NSMakeSize( niWidth, niHeight )]
autorelease];


	[newImage setScalesWhenResized:YES];		// Allow the
new image to scale.


	// Draw the image representaion onto the new image
(which should have the same dimensions).

	[newImage lockFocus];
	[imageRep drawInRect:NSMakeRect( 0.0, 0.0, niWidth,
niHeight )];
	[newImage unlockFocus];


	return	newImage;
}




After loading an image at 300 dpi, it looks great on
the screen at 72 dpi! Then I can scale the image to
whatever dimensions I wish.




--- Ali Ozer <email@hidden> wrote:

> Assuming you have a NSBitmapImageRep, if you set its
> point size
> (setSize:) equal to its pixel size (pixelsWide,
> pixelsHigh), you will
> get a 72dpi image without any loss of quality.
> However, this changes
> the size --- your 300dpi example image will now
> occupy 300/72 more
> space in each dimension when displayed. But I guess
> when you said
> "size" you didn't mean size but pixel size?
> Ali
>
>
>
> Begin forwarded message:
>
> > From: Ian was here <email@hidden>
> > Date: August 24, 2005 15:24:17 PDT
> > To: Apple Mailing List <email@hidden>
> > Subject: Converting JPEG Image Greater Than 72dpi
> To 72dpi
> >
> > I found that if I load a JPEG that has a dpi
> greater
> > than 72 (like 300 dpi for example), I lose some
> bitmap
> > data. I have googled around and found info on
> getting
> > the size of images at various resolutions. What I
> > really need is a way to take a high resolution
> image
> > and convert it into 72dpi while maintaining the
> same
> > size and without losing any quality.
> >
> > Do I ask too much?  Thanks.
> >
> >
> >
> >
> ____________________________________________________
> > Start your day with Yahoo! - make it your home
> page
> > http://www.yahoo.com/r/hs
> >
> >  _______________________________________________
> > Do not post admin requests to the list. They will
> be ignored.
> > Cocoa-dev mailing list
> (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> >
>
> >
> > This email sent to email@hidden
>




____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Converting JPEG Image Greater Than 72dpi To 72dpi (From: Ali Ozer <email@hidden>)

  • Prev by Date: Re: Custom Title bars
  • Next by Date: Re: Alloc Mocks my World
  • Previous by thread: Re: Converting JPEG Image Greater Than 72dpi To 72dpi
  • Next by thread: Problem with ABAddressBook "disappearing" me person
  • Index(es):
    • Date
    • Thread