UIImage save to file problem

Hi,
I am new in iPhone development and I have a problem.
In my viewDidLoad method I have:
previewImage = [[UIImage alloc] initWithContentsOfFile:imagePath]];
self.imageView.image = self.previewImage;
where previewImage is UIImage type.
In View I have a slider to adjust brightness of that image.
- (IBAction) sliderValueChanged:(id) sender
self.previewImage = [ImageHelper brightness:self.previewImage level:self.slider.value];
self.imageView.image = self.previewImage;
+ (UIImage *) brightness:(UIImage *) image level:(float) level
int theheight = (int) image.size.height;
int thewidth = (int) image.size.width;
unsigned char *inbits = (unsigned char *)[ImageHelper bitmapFromImage:image];
unsigned char *outbits = (unsigned char *)malloc(theheight * thewidth * 4);
for (int y = 0; y < theheight; y++)
for (int x = 0; x < thewidth; x++)
float red = inbits[redOffset(x, y, thewidth)] + level;
float green = inbits[greenOffset(x, y, thewidth)] + level;
float blue = inbits[blueOffset(x, y, thewidth)] + level;
if (red > 255.0) red = 255.0;
if (green > 255.0) green = 255.0;
if (blue > 255.0) blue = 255.0;
if (red < 0) red = 1.0;
if (green < 0) green = 1.0;
if (blue < 0) blue = 1.0;
outbits[redOffset(x, y, thewidth)] = (unsigned char) red;
outbits[greenOffset(x, y, thewidth)] = (unsigned char) green;
outbits[blueOffset(x, y, thewidth)] = (unsigned char) blue;
free(inbits);
return [ImageHelper imageWithBits:outbits withSize:image.size];
Methods "bitmapFromImage" and "imageWithBits" are from "iPhone Developer's Cookbook" book.
When I click a button I'd like to save changed image to file as jpeg. The problem is, that I always get a white image with size of imageview. Have somebody an idea what do i wrong?
For saving I use:
[UIImageJPEGRepresentation(self.previewImage, 1.0f) writeToFile:imagePath atomically:YES];
Thanks for any help.

Switch to Grid view - anything you do in Grid view will always apply to all selected images.

Similar Messages

  • I recently updated my macbook, i don't know if that has any effect to my recent problem, but when i try to download and save .mp3 files from the internet, like i have done in the past, it downloads but not as an mp3 file, its "blank"

    i recently updated my macbook, i don't know if that has any effect to my recent problem, but when i try to download and save .mp3 files from the internet, like i have done in the past, it downloads but not as an mp3 file, its "blank" and when i try to open it, i can't? I NEED HELP !

    Here is the download page

  • I am having problems exporting my time lapses from quick time pro i need to save my files as photo jpegs but the standard video compression window will not open fully,

    i am having problems exporting my time lapses from quick time pro i need to save my files as photo jpegs but the standard video compression window will not open fully, it just keeps my mac (old 1.6Ghz 2.5 GB sdram G5 still good for most stuff i need) spinning for ever but i can see compression type H.264 selected and the other setting but i can not select any other options as it still thinking but never opens! why is this happening how do i get round it?
    my work flow is: 300 images shot on a 5d mark II medium jpegs opened in Light Room cropped to 16:9 then exported and opened in quick time i can save a .mov H264 giving me files sizes of 14 mb for a 16 second time lapse, mp4 9 mb. the only way i can get large files is saving as a self contained movie then i get 300mb files.
    i need to save my files 1920 x 1080 photo jpeg codec as i want HD quality.
    i am sure there is a simple way round this?
    thanks guys!

    It is very difficult to offer troubleshooting suggestions when the "os version" you are using is unknown as each os has their own troubleshooting solutions. 
    How large is your hard drive and how much hard drive space do you have left? 

  • PSE 13 crashes whenever I try to save a file.  It worked last week and no longer works.  I tried trashing the preference file.  That didn't fix the problem.

    I installed PSE 13 three weeks ago.  It worked well for a while, then started to crash whenever I tried to save a file for the web.  I trashed the preferences.  That didn't seem to help.  PSE 11 still works well on my Mac, so I think it's a software problem.  I also ran the permissions repair on Disk Utility. I have Yosemite on a MacBook Pro with 4 GB of RAM.

    I've not used Keynote 5.3 in OS 10.7.5 in quite some time, but I do know that in more current OS versions there is a Saved Application State folder in the Username/Library folder which can get corrupted/ messed up when an application crashes. The User Library folder, as I recall, is hidden in the Finder, but accessible by pressing and holding the Option key while clicking on the Go menu in Finder.
    "com.apple.Keynote.savedState" is the folder, or perhaps file, you want to find and delete- making sure Keynote is not open at that time, which if it can't start without crashing will not be a problem.
    This is a "trick" I've used with other applications that got stuck in a loop of trying to restore a pre-crash state, and obviously couldn't start as that state led to the crash. I do not see that savedState file for Keynote on my 10.9 computer, but that is where I would look.
    Good luck!

  • Set Adobe Acrobat XI Pro. When I want to save the file in WORD, EXCEL or esporta file into ... immediately throws an error "save as failed to process this document no file was created". What's the problem?

    Set Adobe Acrobat XI Pro. When I want to save the file in WORD, EXCEL or esporta file into ... immediately throws an error "save as failed to process this document no file was created".
    What's the problem?
    Any help in finding a solution is greatly appreciated.
    Thank you,

    Installed AcrobatXI PRO 11.0.09  on seven computers and laptops. Two of them gives an error when you try to save a document in WORD, EXCEL, Power Point, or when exporting to... error: Save failed to process this document. No File was created.
    But all good saves in the format of TXT and jpg.
    I have uninstalled and restored and re-installed and updated and registry cleaned and removed using the special utility Cleaner Tool for Acrobat, but nothing helps.
    On one notebook with Windows 8.1 and Microsoft office 2013, on another laptop with Windows 7 and Microsoft office 2010, the same problem, although there are computers with Windows 7 and Microsoft office 2010 and everything works.
    Tell me where to find the problem and how to solve it.
    Thank you.

  • 'Save Scanned File As' dialog box causing problems

    A lot of our users just upgraded to Adobe Std 8 from Adobe Std 7. With Adobe Std 8, the 'Save Scanned File As' dialog box comes up even before the document gets scanned (this was not the case with Adobe Std 7). How do you get rid of the dialog box? This is causing us a lot of problems because our Adobe is integrated with a document management program called DM5. With Adobe Standard 8 our users cannot save directly to DM5.Because the
    #Save Scanned File As# dialog box comes up first, now they have to tell Adobe to save it first somewhere other than DM, after the document
    gets scanned they save the document again to DM then they go back and delete the document that they saved in the other location. Is there a registry setting or anything that I can set to get rid of the 'Save Scanned File As' box. If you hit CANCEL, the document does not get scanned so users really do not have a choice but to save the document twice. As I said earlier, this was not the case with Adobe Std 7.

    Is there a registry setting or anything that I can set to get rid of the 'Save Scanned File As' box.
    No.

  • Excel Readpage Save as another file problem

    Hi,
    I have attached the VI needed If you have any problems please let me know. This VI reads a excel page the user points to and displays the results. I have added a single cell where you can change the position of a single cell coordinates so that you can point to a single cell of your choice and retrieve that data. So my problem is now I want to save that data from that single cell to ANOTHER excel file. However, this is not working correctly for some reason I do not know why I believe I have done everything correctly hopfully it is just my inexperiance. I will continue to work on this and update it as I get more time but at the current moment I have hit a brick wall. I have visited the EXCEL BOARD and the vi is from there but I had to add somethings to it in order for it to work correctly as before it wouldn't even run because it was missing some connections and nodes.
    Attachments:
    ExcelReadPage.vi ‏45 KB

    I took a look at the toolkits. The VIs are there, the problem is that
    the linkages are a bit screwed up so the top-level VIs think the subVIs
    are in different places. Also, the toolkits were written using an
    older version of Excel, in which the "Range" object had the property of
    "Value". Excel 2003 uses "Value2". So, if you have Excel 2003 even
    after you load up the VI the "Value" property nodes need to be changed
    to "Value2". This is not a fault of the toolkits - this is due to
    Microsoft changing the ActiveX interface.
    As to your issue: Your basic steps are to:
    Create a new workbook
    Write values to cells
    Save workbook
    The "Write Table to XL" that ships with LabVIEW does that. Launch the Example Finder (Help -> Find Examples) and search for "excel". Then, open the "Write Table to XL". The "Table" control is the data that you want to write. It can be a single cell or multiple cells. If you have a single value, just make a 2D array out of it. As it's written it will prompt you if you want to save the file. This is from the "Close" method. You can wire a True constant to the "SaveChanges" parameter and a path to the "Filename" parameter.

  • I have a problem. When exporting from PDF to PPTX error "unable to process the document in the module Save As file is not created." What to do?

    I have a problem. When exporting from PDF to PPTX error "unable to process the document in the module Save As file is not created." What to do?
    Windows 7 64
    PC

    everything works on a laptop (

  • Save file problem in network hard disk

    I connect to network hard disk called X:
    When i open a pdf file in X: and change something to save.
    A message will tell me "Files can not be saved, can not be saved to this file name, use a different name or save this file in another folder"
    But if I use \\192.168.0.1 connect to network hard disk.
    And do same thing to save file.
    It can save success.
    Anyone have same problem?
    Thanks.
    OS: win 7 professional SP1
    Adobe Reader 11.0.10

    Hey YaoTingHuang,
    Please try saving any other PDF file to the same folder location and check if the same message appears.
    Let me know what happens if you disable protected mode under Edit> Preferences> Security (Enhanced) and uncheck 'Enable protected mode at startup'
    Hope to hear from you.
    Regards,
    Anubha

  • I am not able to download ITunes. I had some problems with ITunes and had to uninstall but now when I reinstall iTunes after I click on download iTunes and save the File, I get this message"Thank you for downloading iTunes" and nothing else happens. I don

    I had some problems with ITunes and had to uninstall but now when I reinstall iTunes after I click on download iTunes and save the File, I get this message"Thank you for downloading iTunes" and nothing else happens. I don't see any thing else. Now not sure what else I have to do.
    Thanks,
    Ranjit

    See the further information area of Troubleshooting issues with iTunes for Windows updates.
    tt2

  • Cannot save Numbers files to our Mac OS X Server (10.6.8) due to permissions problems.

    This is not a univeral problem, only a few people see it, and sometimes only with certain locations of our server. They cannot save Numbers file to the server but they can save it to their desktop and then drag the file to the file server. I have reset permissions for the locations in question to no avail. Any suggestions?In the latest case the iMac is running 10.6.8 and Numbers 2.3.

    Paul,
    This is a long-standing problem with no resolution that I am aware of except to not save iWork documents directly to a server.
    Jerry

  • Preview & Adobe Clearscan save file problem

    Preview appears to have some compatibility issues with Adobe Clearscan OCR'd PDFs. While Preview can view and read the PDF initially and can copy text from the PDF into other applications; if you attempt to save the PDF in Preview (with or without making modifications), the subsequent document loses all of the scanned characters and copied text turns into a series of ␣s. As long as you do not save the file and simply open and close it in Preview, the characters remain intact. Additionally, the other OCR formats in Adobe do not generate PDFs that exhibit this bizarre behavior - they can be saved without loss of characters.
    * Note - Clearscan PDFs were generated in Adobe Acrobat Pro 9.3 on a Windows XP x64 machine while the version of Preview used was 5.0.2 (504) on OSX 10.6.3.

    Hey YaoTingHuang,
    Please try saving any other PDF file to the same folder location and check if the same message appears.
    Let me know what happens if you disable protected mode under Edit> Preferences> Security (Enhanced) and uncheck 'Enable protected mode at startup'
    Hope to hear from you.
    Regards,
    Anubha

  • Save files problem @--}--

    hello,
    i'm writing a textEditor and i want it to alarm the user when he is trying to save a file to a directory that already contains a file with that name?
    how do i do that?
    thank's
    ifat

    save the directory and path of the location you open your file from. If it is a new file, then mark the path as new in some way that is easy for you to understand and manipulate. When you hit your save routine, check to see if the file is being saved to the same location as it was opened from, if not, then check the directory to see if the file exists. If the file exists, then report it to the user.

  • Why do I get a program error when trying to save a file

    I've loaded and reinstalled photoshop elements 3 times. I can not save any files. all i get is cannot save file do to  program error message'
    this is a brand new product with a program error and they want me to pay them to fix there problem. it ain't right.

    which version of Photoshop Elements are you using? Also, do tell us about the flavour of Operating System you are using and the format in which  you are trying to save your file.
    You can also try saving your file to a different location( e.g. desktop) to check if your computer has any permission issues

  • My Illustrator CC, is taking too much time to save my files (the files are not necessarily big).

    It´s been I while since my Illustrator CC started having problems to save files. Even the smalest ones, whenever a hit the save command, (or save as, or save a copy) it takes forever to save my file, whether its an .ai file or .pdf. (export, and save for web are working just fine)
    I´ve tried to change, scratch disk, settings, Adobe creative Cloud settings, even reinstalling my illustrator, but nothing seems to work.
    I use it Professionally, and it has been such a hassle to mange my schedule when every single change I do in my work takes me more than 1 hour to save.

    And it's the local printer that is active in Illustrator?
    Have you tried turning off ICC profile and/or PDF embedding and/or compression?
    Are those CMYK files?
    In that case the color profile is not necessary anyway since you select color from printed samples and acording to the printing process anyway, don't you?

Maybe you are looking for

  • Page includes in html templates

    I see <% include file="header.html" %> in html template working for 'HTML' gallery type web engines. <br /> <br />But, it doesn't work if the gallery type is 'Flash'. It seems the only supported directive includes are %variablename% format. <br /> <b

  • Windows vista and 10g2

    hi everyone! i have oracle 10g 2 and i would like to install it in windows vista. however i take an error. is anything i can do in order to install this version in windows vista? Thank you!

  • How to find out the Streaming speed of a flash player?

    Hi guys! I am Testing web site which is having a flash video files. if I select an video file, it will open a new  window and play the video. now I want to find out the video player in which band with using to play with out any buffering. Actually ou

  • Item filed- conversion agent

    hi,   i read many blogs stating that i can use item fields conversion agent to convert edi into xml. I also read(/people/william.li/blog/2006/03/17/how-to-get-started-using-conversion-agent-from-itemfield)  in this page that i can get the appropriate

  • Can I upgrade to Mac os x lion from Mac os x 10.6

    can I upgrade to Mac os x lion from Mac os x 10.6 and how do i do it?