if ((io->flags ^ rdi->image->flags) & IMAGE_ALPHA)
{
DBG("Aplying background");
- uns flags = rdi->image->flags & ~IMAGE_ALPHA;
- rdi->need_transformations = (flags & io->flags) & IMAGE_NEW_FLAGS;
+ uns flags = rdi->image->flags & ~IMAGE_ALPHA;
+ if (!(rdi->need_transformations = (flags & io->flags) & (IMAGE_NEW_FLAGS & ~IMAGE_PIXELS_ALIGNED)))
+ flags = io->flags;
struct image *img = image_new(io->thread, io->cols, io->rows, flags, rdi->need_transformations ? NULL : io->pool);
if (unlikely(!img))
{