Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7969543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:15:09+00:00 2026-06-04T07:15:09+00:00

I’m running into a weird issue with my UIImage manipulation. I’m doing a dropbox

  • 0

I’m running into a weird issue with my UIImage manipulation.

I’m doing a dropbox sync, and have to store my images as local files. To do so, I save them using the UIImagePNGRepresentation(image) or UIImageJPEGRepresentation(image, 0.66)

Here’s my typical workflow:
User selects an image or takes a photo
Image gets assigned to an imageView
The image view’s UIImage gets saved to a file using the method below

Next time the user re-opens the app, I read the image back from the file using

[UIImage imageWithContentsOfFile:fullImagePath]

This works once.

The second time I run through the routine, I get the error message listed below when trying to save the image to disk once again.

//saving the image
NSData* data = isPNG?UIImagePNGRepresentation(image):UIImageJPEGRepresentation(image, 0.66);
BOOL success =   [data writeToFile:filepath atomically:YES];
if(!success)
{
    DLog(@"failed to write to file: %@",filepath );
}


//loading the image
[UIImage imageWithContentsOfFile:fullImagePath]

I’m getting this error when I try to re-save an image that has been previously converted to JPEG or PNG

2012-05-21 08:16:06.680   file already exists: NO
ImageIO: CGImageRead_mapData 'open' failed '/var/mobile/Applications/C1312BF8-C648-4397-82F3-D93E4FAAD35F/Documents/imageData/LogoImage.jpg'
error = 2 (No such file or directory)
May 21 08:16:06  <Error>: ImageIO: JPEG Not a JPEG file: starts with 0xff 0xd9
May 21 08:16:06  <Error>: ImageIO: JPEG Application transferred too few scanlines

It appears to me that this error is happening due to me trying to re-save the image as JPEG once again. If I ask the view to render itself in context (effectively creating a new image), the error does not happen.

Does anyone know what I’m doing wrong? Am I missing some kind of metadata by trying to convert a UIImage to data, reloading it, and trying to convert it once again after displaying it to the user?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:15:10+00:00Added an answer on June 4, 2026 at 7:15 am

    I’ve run into something similar before. It looked like imageWithContentsOfFile kept the file open as long as the UIImage it was used to create was still alive. At the time, I had gotten around the problem by reading the file into a NSData and then creating the UIImage from the NSData instead of the file directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am currently running into a problem where an element is coming back from
I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.