Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Does Photo Shop or Gimp distort the Edges of a Pic when Cropping?

VonGklugelstein Alter
Bedah Profeshinal Tekstur
Join date: 22 Dec 2007
Posts: 808
07-15-2008 05:37
I am working with some huge textures and before upload I crop them to a size that is accepted here. I noticed that the edges of some of these cropped textures are shaded slightly darker than the pixels next to them.

Is there a way to stop that? I know about anti-aliasing and have it turned off.

How does the Point/Pica size affect this? what is the difference between Post script @ 72 vs Traditional @ 72.27/Inch.. ?


Could this be another reason for the black borders on transparent prims?
Atom Burma
Registered User
Join date: 30 May 2006
Posts: 685
07-15-2008 06:22
Check the resampling options when you are changing the sizes, you may be cropping them slightly. You want to resample them to the new size. And no 72dpi should be just fine. As for the ghosting on TGA files, that's usually just unskilled people building alpha channels. You can remove them by setting your textures inworld to a 99% fill, that usually crops the edges off. Hope that helps. One way to double check them easily is to set your textures to 512, and use the offset filter in Photoshop at 256/256. It will show you exactally what your seams will look like. Sometimes you have to clone away a few artifacts, even when you buy high end textures. There may also be a few oddities from changing formats in Photoshop as well. That can affect the alpha masking as well.
VonGklugelstein Alter
Bedah Profeshinal Tekstur
Join date: 22 Dec 2007
Posts: 808
07-15-2008 07:47
yup.. Unskilled is me.. I just click on everything 9 times until it looks like I want it to.. sometimes Kicking the Computer helps too.. they don't tell you about that method in any tutorials...

Thanks : )
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
07-15-2008 13:48
From: VonGklugelstein Alter
I am working with some huge textures and before upload I crop them to a size that is accepted here. I noticed that the edges of some of these cropped textures are shaded slightly darker than the pixels next to them.


Is there a way to stop that? I know about anti-aliasing and have it turned off.

I think Atom is probably right. If you've got your crop tool set to resample the image upon cropping, then pixels will end up blending, and some of them could darken. I'm not sure about GIMP, but in Photoshop, when you've got the crop tool selected, simply clear any numbers that are in the height and width fields in the tool settings bar at the top of the screen. (Note, you can do this quickly by pressing the Clear button to the right of the fields.)

If that's not what's going on, then you've got me stumped. I've never seen that happen before. Are you sure it's not an optical illusion? Photoshop does put a 1-pixel black border line around all images, if the window is larger than the canvas. That's just part of the GUI, though, not part of the image itself.

Try this. Grab your eyedropper tool, hover over those edge pixels, and take a look at the info palette. The exact RGB values for each pixel you hover over will be displayed. Examine a pixel, crop the image (without resampling), and then examine that same pixel again, being careful to make sure it really is the same one, since its relative position will have changed. Have the RGB values changed? If they have, and you didn't resample when you cropped, then I have no idea what the issue might be.

From: VonGklugelstein Alter
How does the Point/Pica size affect this? what is the difference between Post script @ 72 vs Traditional @ 72.27/Inch.. ?

It doesn't. That stuff only matters for print. It is absolutely meaningless for on-screen imagery.


From: VonGklugelstein Alter
Could this be another reason for the black borders on transparent prims?

Nope.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
VonGklugelstein Alter
Bedah Profeshinal Tekstur
Join date: 22 Dec 2007
Posts: 808
07-16-2008 15:32
Thanks for the detailed responses.. so... I also tried resampling with the " nearest neighbor" selected and that seemed to keep the edges perfect as well. I keep finding new buttons to push on that thing..

I haven't been able to duplicate the problem, so it was probably just too much crack that day... haha plus It doesn't help that I use PS to make the images and then use Gimp to apply the alpha channel and sometimes I forget to crop/resize before doing the mask in the other program.

Who knows what gimp does while it resizes.


:)
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
07-16-2008 16:34
From: VonGklugelstein Alter
I use PS to make the images and then use Gimp to apply the alpha channel

I'm curious why you'd do that. Either program is more than capable of doing both things. Why not use use one or the other from start to finish?
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
07-16-2008 22:37
i know it must be a cold day in hell ... but photoshop is actually a tincy bit easier to do alpha channels in (not much, mainly just cause its pretty much there in your face)
Abu Nasu
Code Monkey
Join date: 17 Jun 2006
Posts: 476
07-17-2008 02:09
The only problem that I've run into along these lines is transparency/opacity along the edges when using Image > Image Size. When resizing, I've long since gotten into the habit of making sure that the edge pixels are 100% opaque. Well, when working on a Layer, and I'm not entirely sure if working on Background makes a difference.
VonGklugelstein Alter
Bedah Profeshinal Tekstur
Join date: 22 Dec 2007
Posts: 808
07-17-2008 04:06
From: Chosen Few
I'm curious why you'd do that. Either program is more than capable of doing both things. Why not use use one or the other from start to finish?


The main reason is that my Version of Photoshop has issues with Alpha Channels. It appears that my Disk, which I bought for my employees for use at work was also installed and registered by about half of my employees on their home computers and the Software Key was Blacklisted so I can't get the fix installed.

The second Reason is .. I don't know how to use Gimp ..yet

Third reason: I get off on complexity and mayhem and carnage in general.

I am not a graphic " Deeeesiggnorrrrr" or Builder or Texture Artist so I am not going to invest the money for a new copy.

I use Gimp only for the textures with transparency. Luckily most of my textures are not transparent because Gimp uses a lot of steps to make a tga.

I might post a thing on how to use Gimp for making tga's soon because when I asked on the forum on how to, nobody knew exactly.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
07-18-2008 15:23
save as filename.tga

if your talking about adding alpha

image, transparency add alpha channel then make a mask using image,mask, add mask and set it to the images alpha channel
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
07-18-2008 16:52
From: VonGklugelstein Alter
The main reason is that my Version of Photoshop has issues with Alpha Channels.

Ah, must be 7.0. Yeah, if you've got that version, then it would make sense to use something else to make your alpha channels.

From: VonGklugelstein Alter
It appears that my Disk, which I bought for my employees for use at work was also installed and registered by about half of my employees on their home computers and the Software Key was Blacklisted so I can't get the fix installed.

That's a strange story, but I'll take your word for it. :) The serial number status really shouldn't matter, though. If all you need is the TGA fix, all you have to do is replace one file. No verification is involved. Simply go to http://www.adobe.com/support/downloads/detail.jsp?ftpID=1544 , download the file, unzip it, and drag it into the appropriate folder to replace your existing targa.8bf file.

If you want the full patch, not just the TGA fix, it's at http://www.adobe.com/support/downloads/detail.jsp?ftpID=1851 . Again, if you download it and install it manually, it shouldn't involve your serial number at all.

I hope that helps. :)


From: VonGklugelstein Alter
Third reason: I get off on complexity and mayhem and carnage in general.

Well, if that's the case, you should do very well with GIMP. :D



From: VonGklugelstein Alter
I might post a thing on how to use Gimp for making tga's soon because when I asked on the forum on how to, nobody knew exactly.

If you find a good way to make alpha channels from scratch, totally independently, without having to source from layer transparency, please post it. That's been one of my biggest hurdles with GIMP. It doesn't seem to want to let you depart much from WYSIWYG methodology. Someone a while back suggested using the Decompose command, which sounded promising, but I never ended up finding the time to play with it.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
07-18-2008 21:52
From: Chosen Few

If you find a good way to make alpha channels from scratch, totally independently, without having to source from layer transparency, please post it. That's been one of my biggest hurdles with GIMP. It doesn't seem to want to let you depart much from WYSIWYG methodology. Someone a while back suggested using the Decompose command, which sounded promising, but I never ended up finding the time to play with it.


not totally sure i understand the question

above i posted a way, not sure its what your asking about, but its a full blown mask like most are used to dealing with in older photoshop / paint shop / ect

edit)
actually you dont even need a layer mask, so its just like photoshop, add a alpha channel in the layers menu (i said images before but i happen to be in the gimp now) and use the eraser tool = paint directly on the alpha channel

its been a while since ive dealt with alpha graphics more than "color to alpha" or "just start with a transparent bg and biuld on that" so please excuse my rustiness
Court Goodman
"Some College"
Join date: 10 May 2006
Posts: 320
07-22-2008 16:21
Ive been running into this issue a lot lately, trying to make some seamless repeatable textures, particularly flooring with baked-in lighting and shadows. I've noticed it really depends on the texture. For lighter textures, i'll sometimes have to run down the edge of the image in PS using the healing brush at a very very small size...2 or 3 px. This isnt always successful-- again it depends on the image itself that i'm working on.

I had posted a similar question a few weeks back...digging up the URL....

/109/b5/267762/1.html

interesting solution in there by Abu... involves "stretching" the image over the canvas (im speaking metaphorically, youll have to read to understand) -- this method worked pretty well for lighter images.

One thing i have a problem with is starting somethign in ultra-high resolution in Photoshop, something im getting out of since most of that detail gets lost anyways, and reducing the size really blurs those edges and causes artifacts.

I tried doing the "99%" technique of covering a prim with a texture that overlaps, but from a distance of 100m or so within SL, you can see those edges.

Im starting to believe that there's no perfect way to seamlessly map a texture perfectly in SL, its all about task-specific workarounds, but such is life.
Amity Slade
Registered User
Join date: 14 Feb 2007
Posts: 2,183
07-22-2008 16:35
From: VonGklugelstein Alter
I am working with some huge textures and before upload I crop them to a size that is accepted here. I noticed that the edges of some of these cropped textures are shaded slightly darker than the pixels next to them.



I don't know a whole lot about texturing for Second Life, and I've been trying to do my reading to learn. One little piece of information that caught my eye recently was this from the Second Life Knowledge Base:

"TGA (supports alpha channel) or bitmap. When you upload an image the SL client will internally convert it to JPG2000. Avoid saving your work as jpeg; the quality may suffer because of the double jpeg conversion."

Could your problem be caused by the conversion by the SL Client?

The effects of the conversion may not be perceptible when working with small textures. If you're dealing with large textures that are chopped up into pieces and converted one at a time, then that might make the otherwise small changes introduced by the conversion process more noticeable.
VonGklugelstein Alter
Bedah Profeshinal Tekstur
Join date: 22 Dec 2007
Posts: 808
07-23-2008 06:44
From: Chosen Few



If you find a good way to make alpha channels from scratch, totally independently, without having to source from layer transparency, please post it. That's been one of my biggest hurdles with GIMP. It doesn't seem to want to let you depart much from WYSIWYG methodology. Someone a while back suggested using the Decompose command, which sounded promising, but I never ended up finding the time to play with it.


Making an alpha mask is like trying to score a date with a hot chick in a super market. There are thousands of ways to do it but you still have to get lucky to produce a perfect outcome. Yesterday I spent an hour trying to make a french door and totally destroyed the image trying to get the glass to look good in it, but then I made an awesome piece of glass in about 10 minutes that looks like it should have taken days to make.

I have succesfully used the following techniques in photoshop( it depends on the type of image and most of the time it is a combination of several techniques) I believe Gimp has the equivalent tools available as well.

Threshold - this is a powerful tool for alpha masks when you are looking for a quick way to get some... works for anything that has good contrast

Invert and Desaturate - Copy the picture - Invert it then Desaturate it and then adust the contrast - you will then have to look for areas that need to be 100% opaque and retouch or find a way to extract those areas and add them to the mask

Select Color Range - This is also a very powerful tool to selectively extract Highlights and shadows and to touch up lighting inconsistencies - there are too many options to get into but play with this and you will see.

Magic Wand... this is a pain but works well if you use the anti-aliasing to your advantage.

Eraser? you could not pay me enough to sit there and erase a Mask for an entire image manually - also chances are that it will have many flaws

The Channel Decompose is rocket science and considering you are taking a picture and ripping it down to 512 pixels in most cases makes no sense and is not worth the effort. You should always keep it simple if possible.

_____________________________________________

With relation to this post's subject !!! always have the images resized before creating the alpha channel and applying the mask !!! I usually verify the tiling with the offset filter and when resizing I resample using " nearest neighbor " which gets rid of a lot of inconsistencies if there are any along the edges.

I always make the masks in Photoshop and then save them as a Jpg along with the main Image.

So in Gimp you end up working with 2 independent files - 1 Main Image - 2 Alpha Mask Image (in the main image all areas that are supposed to be transparent should be pure black)



Open the Main Image
Create (Add) Transparency in Layer
Create Alpha (Add) Mask in Layer Select "Layer's Alpha Channel"

Open the Alpha Image - select all - then Copy it - close the image

Then go to your layer Dialog in the main image and you will see a blank white box next to the thumbnail of the Main Image

Click on the blank box and paste ( the copied alpha mask Image)

This will create a temporary floating layer which you must anchor by clicking the little icon just to the left of the trashcan symbol (bottom right)

This will apply the mask to the image. Then you just save as a tga file - done.
VonGklugelstein Alter
Bedah Profeshinal Tekstur
Join date: 22 Dec 2007
Posts: 808
07-23-2008 07:09
From: Court Goodman


One thing i have a problem with is starting somethign in ultra-high resolution in Photoshop, something im getting out of since most of that detail gets lost anyways, and reducing the size really blurs those edges and causes artifacts.

I tried doing the "99%" technique of covering a prim with a texture that overlaps, but from a distance of 100m or so within SL, you can see those edges.

Im starting to believe that there's no perfect way to seamlessly map a texture perfectly in SL, its all about task-specific workarounds, but such is life.



I work with images no bigger than 2048 on any side to start, that is way more than needed but still gives you a lot of detail in case you need to get microscopic..

When reducing the size (final reduction down to 512 or 1024 whatever) if the image is really light on the edges I use nearest neighbor which appears to nail the edges perfectly. It is rare that I have to change the default though, just sometimes.. It is important to always check ( I learned the hard way) your work before uploading... also use the offest filter before resize and then reoffset it in the final copy works to hide any potential problems.

The 99% technique can not be applied to seamless tiling anything.. in order for it to be seamless it needs to be 100% I have many textures that tile flawlessly and without shadows or repeat strobe effect over great distances, so it is very possible to get perfect but it is not always possible. I have ditched some of my what should have been most awesome textures because there was some kind of flaw in them that became really noticeable only after it was applied to a prim in world.
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
07-23-2008 09:00
From: VonGklugelstein Alter
The 99% technique can not be applied to seamless tiling anything.. in order for it to be seamless it needs to be 100%

Actually, you can do it at less than 100%. You just need to set up your texture accordingly beforehand. At least, it should work in theory. I've never actually done it myself. I see no reason why it shouldn't be able to work, though.

For cleanest results, you'll want to use a number that divides evenly into power-of-two sizes. The largest percentage that does that is 75. Depending on the image, you may be able to use larger percentages without any noticeable problems, but since 75 will always work, let's go with that as our example. Here's one way to do it:

1. Create your image at 75% of whatever size you'd normally use. For this, let's go with 768, which is 75% of 1024.

2. After you've made your image, turn it into a pattern. (Filter -> Pattern Maker)

3. Increase your canvas to its full size, which in this case, means 1024x1024. (Image -> Canvas Size)

4. Flood the canvas with your new pattern. (Paint Bucket tool, set to Pattern mode) The image will naturally end up repeating 1/.75 times to fill the whole canvas.

5. Save the file, and upload to SL. Now when you apply the texture to a surface, and set the repeats to .75, you'll get one instance of the image.


The obvious downside to this is you waste 25% of your pixels. But the upside is you can chop up a large image into 768x768 pieces, and then reassemble the image seamlessly in SL. You shouldn't do this very often, of course, since the texture memory load is insane with a separate 1024x1024 on every prim. But if you absolutely, positively, must have a super-sized texture spread across multiple prims, that's the way to do it.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Court Goodman
"Some College"
Join date: 10 May 2006
Posts: 320
07-23-2008 09:33
From: VonGklugelstein Alter
Making an alpha mask is like trying to score a date with a hot chick in a super market.



Is that why my masks are always slapping me in the face?
Court Goodman
"Some College"
Join date: 10 May 2006
Posts: 320
07-23-2008 09:48
From: Chosen Few



.....

The obvious downside to this is you waste 25% of your pixels. But the upside is you can chop up a large image into 768x768 pieces, and then reassemble the image seamlessly in SL. You shouldn't do this very often, of course, since the texture memory load is insane with a separate 1024x1024 on every prim. But if you absolutely, positively, must have a super-sized texture spread across multiple prims, that's the way to do it.



interesting. Im about to rebuild a rather large and abusive mega-sized texture :)

http://www.flickr.com/photos/courtgoodman/2447212367/sizes/l/in/photostream/

what can i say, im just not satisfied with the SL night sky ;) but if you look closely on the original size, the image borders are visible on the crops, such as on the purple nebula. I am going to try techniques mentioned in this thread over the next few days and see how they come out.

the original photoshop work is 6144 x 2048 px at 72dpi. i originally did a quick crop into 512-px chunks which load rather quickly because they are very sparsely-populated with pixels. (strangely it takes longer to load the image in flickr than it does the environment in second life)

I layered the planets and nebulae on top using alpha'd tiles. giant prims but nothing over 20m . final size is about 1/4 sim cubed. therefore image compression is important, but i take realism over download time any day. Its just those borders driving me nuts. Looking forward to trying the techniques mentioned in here