c# - Change an image dpi without changing it's pixal format -


every time try change image's dpi, pixel format (color scheme - rgb, cmyk , such...) seems change. time did succeed in saving pixel format, dpi, on debug mode, seems change, after process complete, changed it's original settings.

the code tried followed:

        using (var ms = new memorystream())         {             using (var bmpinput = image.fromfile(path) bitmap)             {                 using (var bmpoutput = (bitmap)bmpinput.clone())                                         {                     foreach (var id in bmpinput.propertyidlist)                         bmpoutput.setpropertyitem(bmpinput.getpropertyitem(id));                                             if (doresize)                         bmpoutput.setresolution(dpi, dpi);                      bmpoutput.save(ms, bmpinput.rawformat);                     return ms.toarray();                 }             }         }  

application.doevents(); 

try before saving image in code.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -