Blog posts about photoshop

  • Photoshop: Copy to new color problem

    December 09, 2010 | Tags: Photoshop, Troubleshooting
    A rather bizarre problem occured today. After recieving a layered PSD-file from an Art Director and trying to copy a single coloured layer into a new image I ended up with a layer with a different color but not only that. It seemed to be dithered as well! Looking into settings, nothing appeared wrong. After some trouble shooting I finally found it: The color profile embeded with the PSD-file was missing or didn't match the once I've installed, but Photoshop didn't say a word about it.

    This is how to fix it:
    1) Goto the menu and Edit / Color Settings...
    2) Check all boxes for Profile Mismatches and Missing Profiles
    3) Done!

    Now you can copy and paste as new AND get a warning when the profile mismatch instead of just getting the layer with all the colors wrong.

  • .Net unsharp mask filter

    January 20, 2010 | Tags: Photoshop, Image Library, C#, Snippet, Open source

    If you're familiar with Photoshop or any other photo manipulation tools you've probably come across a filter called unsharp mask. It works by making a gaussian blur copy of the image and then comparing it to the original image and extruding the differences, which appears around the edges, resulting in a very sharp and crisp image.

    This kind of filter is truely awesome if you're creating thumbnails as they useally becomes somewhat blurry. Applying an unsharp mask makes a very nice thumbnail.

    And if you're looking to do this with C# code, you've come to the right place. Because this filter was introduced in version 1.1 of the .Net Image Library.



    As with most of the filters I've tried to keep as close to the Photoshop filter parameters as possible. So if you're working with an Art Director that wants an unsharp mask with the amount of 32% and a radius of 1.4 pixels, you can just answer "No problem" and add one more line of code to your project.

    How to implement

    So lets start with the code. But first, head over to C# Image Library and download either the latest source code package or binary version or install through nuget.org.

    Add a reference to Kaliko.ImageLibrary.dll or the NuGet package ImageLibrary to your the source code project.

    To make this more readable, I'm assuming that you're also have these two lines in your code:

    using Kaliko.ImageLibrary;
    using Kaliko.ImageLibrary.Filters;

    We're assuming the above, that you want the equality to an amount of 32% and a radius of 1.4 pixels in Photoshop. The first parameter passed to UnsharpMaskFilter is the radius, the second the amount.

    // Load image from file
    KalikoImage image = new KalikoImage("c:\\images\\garden.jpg");
    
    // Create a thumbnail of 128x128 pixels
    KalikoImage thumb = image.GetThumbnailImage(128, 128, ThumbnailMethod.Crop);
    
    // Apply unsharpen filter (radius = 1.4, amount = 32%, threshold = 0)
    thumb.ApplyFilter(new UnsharpMaskFilter(1.4f, 0.32f, 0));
    
    // Save the thumbnail as JPG in quality 99 (very high)
    thumb.SaveJpg("c:\\images\\garden-thumbnail.jpg", 99);

    That was pretty easy, wasn't it? :)

    Use the faster unsharp mask filter

    The core .Net Image Library was written to be compatible with medium trust environments (such as many web hosting providers). But if you can run in a full trust web environment or are developing a Windows application you should definitely check out the package of optimized filters and use them instead. On a Intel i7-2600k the fast filter is about 5 times faster as the compatible filter!

    Use the faster filters by adding the ImageLibrary.FastFilters NuGet package to your project (make sure to select pre-release in the NuGet manager to get the latest version). All optimized filters are prefixed with Fast. So instead of UnsharpMaskFilter you use FastUnsharpMaskFilter.

    using Kaliko.ImageLibrary;
    using Kaliko.ImageLibrary.FastFilters;
    
    // ...
    
    // Load image from file
    KalikoImage image = new KalikoImage("c:\\images\\garden.jpg");
    
    // Create a thumbnail of 128x128 pixels
    KalikoImage thumb = image.GetThumbnailImage(128, 128, ThumbnailMethod.Crop);
    
    // Apply unsharpen filter (radius = 1.4, amount = 32%, threshold = 0)
    thumb.ApplyFilter(new FastUnsharpMaskFilter(1.4f, 0.32f, 0));
    
    // Save the thumbnail as JPG in quality 99 (very high)
    thumb.SaveJpg("c:\\images\\garden-thumbnail.jpg", 99);

    .NET Image Library also includes easy-to-use filters for:

    • Gaussian blur
    • Brightness
    • Contrast
    • Desaturation
    • Invert
    • Chroma key (blue/green screening)

    All these filters are also available as optimized multi-threaded versions.


  • Quick way to copy layer masks in Photoshop

    September 24, 2009 | Tags: Photoshop, Snippet
    Hold down CTRL + ALT and drag and drop the layer mask you want to copy onto the layer where you want it.

  • Droplet problem in Photoshop (and solution)

    February 12, 2009 | Tags: Photoshop, Troubleshooting

    Had some problem with creating a droplet in Photoshop CS3. The droplet exe was created correctly but when I tried to run it (by droping a file onto it) nothing happened except that Photoshop started, but no file was loaded or processed.

    After some search I found a sollution. The problem was that registry keys pointed to my previous Photoshop version (which was CS2). This seems to occur at upgrades of Photoshop. If you have a simular problem (will probably work in other Photoshop versions where Adobe's installer hasn't changed the registry keys correctly) you can fix this by doing the following:

    1) Download the DropletFixer.zip from this page http://www.adobeforums.com/cgi-bin/webx/.3bbc8126

    2) If you have increased the security on your machineyou might have assigned the run command to open any .vbs file in Notepad instead of running it. In this case you need to run it manually by entering the command prompt (run "cmd") and then write the following "cscript c:\dropletfixer.vbs" (or where you have placed the file).

    If you're concerned about running scripts and files from the internet you could open the vbs and do the operations manually. If you know any programming language you would understand the code in the file as it's pretty straightforward.