#assets:image generating corrupt image when setting a size on a non webp file

1 messages Β· Page 1 of 1 (latest)

unreal topaz
#

Hey, so I have some png, jpg and webp photo in /src/assets.

If I set a size on the png or jpg files, they come out corrupted (black and white and burned looking), but setting the size works fine on webp files.

Example png image with width and height applied attached.

rapid cypress
#

hi ronnie πŸ‘‹ is this issue happening to a specific set of images your project is using? If you use a cdn for the same images, does that works out?

unreal topaz
#

I am using local images, and it is happening to all jpg and png images

rapid cypress
#

can you share your project info by sharing results from npm run astro info

unreal topaz
#
Astro                    v4.1.1
Node                     v20.10.0
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             astro-icon
rapid cypress
#

I will suggest upgrading it using npx @astrojs/upgrade (in a different branch to save your work) and check if that solves the Issue

dull carbon
#

Are you using the default image service?

unreal topaz
#

I am sorry but the upgrade did not fix the issue. I just want to add that if I set the size but set it to exactly the original photo size, the issue does not occur.

#

Should I report this on github?

rapid cypress
unreal topaz
#

sure

#

the fossify-website branch

rapid cypress
#

because you have placed all your images inside public directory, no optimization takes place when using <Image />
I could not detect the corruption so far but because you want to use <Image /> your image needs to be placed inside src directory

// Footer.astro
---
import { Image } from "astro:assets";
import logohorizontal from "../assets/Logo-horizontal.png" //the image is stored in src/assets folder
---
<Image
  src={logohorizontal}
  alt="horizontal Fossify logo with title"
  height="75"
  width="200"
/>
#

similar logic but applied in App-card.astro

<Image
    src=`/src/assets/app-screenshots/${app?.data.img}` // the images are stored in src/assets/app-screenshots folder
    alt=`${app?.data.title} screenshot`
    width="220"  //no need to specify unit when using <Image />
    height="400"
  />
unreal topaz
#

I do have my photos in assets and not in public

#

that is another thing, I have to /src/assets.. and can't use ../assets/... (I am sorry, this is not true, I had a typing issue)

rapid cypress
unreal topaz
#

it is pushed and is in the fossify-website branch

rapid cypress
#

ohh damn, i have been in main branch for so long facepalm

unreal topaz
#

πŸ˜…

rapid cypress
#

cant find the corruption in Chrome Browser in footer with this snippet

<Image src={logo} alt="horizontal Fossify logo with title" width={200} height={72} />
unreal topaz
#

I am using firefox and can confirm it is working in Chrome

rapid cypress
unreal topaz
#

so it is a firefox issue

rapid cypress
#

clean install πŸ˜•

unreal topaz
#

😭

rapid cypress
#

any settings or extensions acting up?

#

i will try building and previewing
edit: no issue found in preview

unreal topaz
#

I did disable all the extensions and gettings the same results.

#

I will try on another PC

#

I am sorry I waisted your time by not testing enough on my side

rapid cypress
#

ahh its fine, firefox issues are legitimate concerns for a plethora of users

rapid cypress
unreal topaz
#

That did not work

#

What version of firefox are you running?

#

I am on 124.0.1 on Fedora Linux 39

rapid cypress
#

124.0.1 Windows 10

unreal topaz
#

Thank you a lot

rapid cypress
dull carbon
#

I do not know what the issue could be

rapid cypress
#

apologies for dat πŸ™

unreal topaz
#

I am installing a virtual machine to test it there

unreal topaz
#

OK, I did some testing

#

Works fine in windows, firefox 123 and 124

#

Doesn't work on fedora linux 39 and latest nightly build firefox 123 and 124

#

tried with npm 20.10 and 20.11

#

Should I open an issue on github?

dull carbon
#

I doubt there's anything we'd be able to do

unreal topaz
#

Where should I report this then?

#

I will try changing the service

dull carbon
#

We don't own the code for processing the images, we just use Sharp

#

So maybe Sharp?

#

But it just seems like a bug in Linux or Firefox

unreal topaz
#

yeah, if the other service doesn't have this issue, then maybe Sharp has an issue on linux and firefox

#

yeah, it is pretty weird how specific it is.

#

tried with sqoosh, got same issue