PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, July 17, 2022

[FIXED] How to avoid aliasing when you place a GIF image over a PNG image?

 July 17, 2022     css, gif, image, png     No comments   

Issue

I have two images. The background image is in png format and the second image on top is in latex gif format. When I place the second image on top of the first image, it causes the first image to be blur.

The image looks like this when combined, (1/5 is actually an image here):

enter image description here

How to avoid the blur in the second image when I place the second image on top of the first image?


Solution

It isnt blur. Pixels on gif / 8 bits png are 100% transparent or 100% solid. So, to let the transparency softer, photoshop simulates 1-99% alpha with half tone pixels.

In a example, if you have a black image that is going to be on a white webpage (matte color), photoshop produces grey pixels to let the transparency softer. It works good in this scenario but it becomes a mess when you use this same image on a different background.

When you're at photoshop with your original transparent image, click on "save for a web", then do one of the following:

1- Save it as a png 24 bits (with transparency box checked) and it will be ok no matter the background where you'll put it on (deep transparency, no worries).

2- If you want a smaller file size and choose gif or png 8 bits, you must select a matte (color that will be at the background on your website). The result isnt perfect over multi-color/textured backgrounds; anyway, in your sample the matte is "#ca7e29".



Answered By - L777
Answer Checked By - Marilyn (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing