Optimizing the logo image uploaded by the journalist


I would like to gather some opinions on which method is better for optimizing the logo image uploaded by the journalist, with respect to resizing and cropping. There are 2 possible approaches-

  1. Resize the image to a fixed maximum height/width while preserving the aspect ratio. Results in- Reduced size, same aspect ratio, whole image

  2. Crop the image to a square (from center), before resizing to a fixed maximum edge length. Results in- Reduced size, square logo, parts of image lost which user cannot control if he/she uploads a non-square image

Which method looks more suitable? Any new suggestions are also welcome.

Hi aywdi, a few questions:

Is there a specific logo aspect ratio that’s supported on SecureDrop?

Is it visible to the user anywhere? (So they can make sure the logo they upload fits the aspect ratio)

When a journalist uploads a logo, it is saved as it is, in its original size and aspect ratio. Ideally, a square image will work best.

SecureDrop does not specify any aspect ratio to the user.

I think a maximum width with maintained aspect ratio would be best here rather than cropping the image to prevent any kind of loss of image parts unpredictably. Also I agree with @ei8fdb that there should be some kind of information shown somewhere about the maximum and minimum width of a logo so the journalist can pick images on that basis.

1 Like

FYI in the source and journalist templates the logo width is forced at 250px. On the source home page there is no constraint on the width or height, reason why the documentation suggests a size of 500px x 450px.

There definitely is room for improvement :wink:

Any particular reason the suggested size is not a square image?

Not that I know. I think it just happens to be this way :wink:

Looks like it is because of the size of the default image: https://github.com/freedomofpress/securedrop/blob/develop/securedrop/static/i/logo.png

@saptaks @dachary How does this look?

1 Like

Sorry for the potentially silly question - but why is the logo width forced to a particular value? Just to understand what the ultimate need for a particular width is.

I think this is a good beginning because the SecureDrop is telling the user the dimensions of the logo needed, allowing them to make prepare the correctly sized image.

The image upload could be then handled by either:

  • making these dimensions mandatory "sorry the image isn’t the correct dimensions"
    or better would be
  • to provide the user with a way of cropping the image they’ve uploaded to the defined dimensions

Maybe these links are useful.

There is a single file with the logo. But it must show in two different sizes. The 250px width constraint reduces the size of the logo and makes it look small. That’s the technical reason why :wink: