Fixed larger size of image by allocating memory on the heap for pixels