.net - OutOfMemoryException in byte array for BitmapSource -


i've changed question quite bit believe more context make sense

i'm trying create new bitmap dpi existing image.

however outofmemoryexception on large images, when trying create byte array so

private function convertbitmaptoxdpi(bitmapimage bitmapimage, newdpi integer) bitmapsource      dim width integer = bitmapimage.pixelwidth      dim height integer = bitmapimage.pixelheight 'value => 3456       dim stride integer = width * bitmapimage.format.bitsperpixel 'value => 110592      dim pixeldata byte() = new byte(stride * height - 1) {} ' <- exception!      bitmapimage.copypixels(pixeldata, stride, 0)       return bitmapsource.create(width, height, newdpi, newdpi, bitmapimage.format, nothing, pixeldata, stride)  end function 

the method used converter change dpi of images. throws outofmemoryexception on marked line.

my question if there's way i'm trying to? above works fine smaller images, image of larger size, happens


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -