Skip to content

Resize and converting from .png (with transparent background) to .jpg adds a black background #348

@GabrielLyonB

Description

@GabrielLyonB

Hi there 👋 ,

Context

I'm using the image_processing gem to resize_and_pad every image in my website (into different sizes and to make them lighter).
I found that there is an option to add background but it only applies on the remaining area of the resized image. Here is the issue i open in that gem, but their answer brought me here.

My Problem

I have this one case in which, i convert a .png file with transparent background to a .jpg file. The result is a .jpg image with black background.

Questions

  1. Is this the expected behaviour?
    1.1. I this is the expected behaviour, is there a way to change the default background?
    1.2 If not, is there a way to add a background to the image?

I recognize that this question might be simply wrong because the way i which that upper level concept ("changing a backgorund") might be different from how is implemented in reality.
Also, i've been trying to read the documentation and the methods descriptions but i can't figgure out which method to use and why.
Apreciate any help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions