Showing posts with label slice select tool. Show all posts
Showing posts with label slice select tool. Show all posts

PS 09 - How to Save Selected Layers from a Document

21 January, 2013

At times when you have a huge layers with all kinds of graphics, and saving a selected layer is always a hardest task.

There is a way where you can save only a selected layer content from photoshop. But, there are some limitations for the image format.


For this tutorial, I have created 8 simple boxes with simple graphics which we are going to export. First step we'll separate and save all the boxes. Second, select a few of them and replace only the selected ones.

Before we start let see how the layers are arranged. It is always a good practice to organize your layers.

(fig 1.0)

Based on the layer palette (fig 1.1 - 1), each and every box are in a separate layer.

And since we have two layers (the graphics and its background), we can combine as one with smart object. (fig 1.1 - 2)

(fig 1.1)

If we save this image (fig 1.2), we'll get an output as single image. To separate, we need to crop them individually. or
Since these are converted into smart objects, we can go inside each and every smart object and save them individually.

Right now it might NOT look like time consuming but what if you have more than 8 layers.

What we want is a more flexible way, so later if we need to edit the graphics or change the color, we can able to save only the selected content and not everything.

(fig 1.2)

First step is to tell photoshop to see each and every individual box separately. So when we save this file, it will all be saved as a separated image.

Because each and every box has a even shape, the easiest way to do is to Slice them first and save them with save for web dialog box. Save for Web is not only for Web, you can also use it to save normal images with JPEG, PNG, or GIF format.

Select the Slice Select Tool from the Tool bar (fig 2.0 - 1) and click on the button 'Show Auto Slice' to display the default slice (fig 2.0 - 2). Auto Slice is always be there in any opened image or any new document created inside photoshop. This will act as a base for all the slices.

 You can learn all about how auto slice works >> Essentials for Slice Select Tool I

(fig 2.0)

Now that we have auto slice in our document, lets see which slice type we can use to slice our image.

There are two kind are slices we can use here. One is User based slice and another is a Layer based slice. Because all the boxes in different layers, using a layer based slice is more effective. This will slice the box based on the layer content.
Another option is to use Divide option which will convert auto slice to user based slice automatically.

Learn more about User based slice and Layer based slice >> Essentials for Slice Select Tool II

For this tutorial we'll use Divide options on auto slice.
With the Slice Select Tool selected, select the auto slice in the document and click 'Divide' from the options bar (fig 2.1). Divide option won't work on auto-slice, but it will automatically Promote to User based slice.

Notice the symbol color and the handles around the image once the divide dialog box is opened.

(fig 2.1)

Use 'Divide Horizontally Into' and 'Divide Vertically Into' to add sections. Type the numbers you want to add more slices. Click 'OK'.

Each slice has its own number and these numbers are generated automatically. This will be the file name when you save these slices.

(fig 2.2)

Go to 'File' menu and select 'Save for Web'.

In the Save for web dialog box select the format to 'JPEG' and click 'Save'. You can also select other formats from the drop-down list.

(fig 2.3)

In the 'Save Optimized As' dialog box, select the format as 'Image Only' (because we don't need any html files) and select 'All Slices' as slices option and click 'Save'.

You can learn more about slices for HTML >> Essentials for Slice Select Tool IV

(fig 2.4)

Now we have all the boxes saved individually with JPEG format.

(fig 2.5)

Now lets edit some graphics (fig 3.0). The first set is the original design and the second set is where the graphics are changed.

01 graphics is moved to 04
04 graphics is moved to 06
06 graphics is moved to 01
(just so you can see more clearly i have reduced the transparency for other slices)

Let's save/replace only the edited slices (01, 04, and 06)

(fig 3.0)

Go to 'save for web' dialog box and select (hold 'Crtl' (Cmd in mac) to select multiple slices) only the changed slices (fig 3.1 - 1) and click 'Save'.

From the 'Save Optimized As' dialog box select 'Selected Slices' (fig 3.1 - 2) as slices option and click 'Save'.

'Selected Slice' will save only the slices you have selected inside save for web dialog box. By selecting this option you can avoid saving all the slices again.

(fig 3.1)

This will replaced the images. If you don't want to replace, you can change the location in the 'Save Optimized As' dialog window.

(fig 3.2)

You can see the replaced slices (fig 3.3 - 2).

In the Slice option inside the 'Save Optimized As' dialog box there are three options you can choose from.

All Slices: This will save all the slices including auto slice
All User Slices: This will save all slices (user based slice, layer based slice, and subslice) except auto slice
Selected Slices: This will save only the Selected Slice(s) from 'Save for Web' dialog box. You can also use auto-slice for this option

(fig 3.3)

When working on webpage design, most of the time there are minor corrections happen for images or buttons, and replacing only the changed graphics and not the complete design is always a huge time saver.

Photoshop CS6 Essentials - The Slice Select Tool - IV

07 January, 2013

So far we have seen, how to create a slice, how they work, how to promote and divide them, and the types of slices. Now we'll put all those to use...well, not everything but most of it.

You'll get a much better understanding at the end of this essential to what exactly the slice tool is and how important it is when designing a website mockup.

If you haven't seen the other parts, please start from here >> Essential for Slice Select Tool 1 . If you just want to understand the HTML stuffs then continue with me.


We are going to use this simple (fig 1.0) banner to slice our content and add options. These will reflect in a browser.

Please note that, Slice Options does not replace the full HTML coding, but you can make a simple navigation for website mockup. 

// Download the Exercise files to follow along with me >> the complete slice tool.zip toolbar.zip

I'll just explain what we are going to do with these two PSD designs

(the complete slice tool.psd)
1. small toolbar image - Click the toolbar small image will open a full size toolbar with back button.
2. 'The Complete Slice Tool' - we are going to replace this with our own HTML text.
3. Photoshop CS6 -  which display as a button in a browser when we mouse-over, and click on the button will take us to the photoshop website (you can give any site you want).

(toolbar.psd)
1. Full size toolbar with Back button - we want to return to our banner once we click the 'Back' button, so we are going to assign a URL which will send us back to the main banner.

Remember everything we are going to do inside photoshop and no extra plugin needed or filters. And i'll explain you step by step.

(fig 1.0)

Before we start, lets look at how the layers are arranged (fig 2.0) and what sort of slice style we can use. It's a good practice to understand the layer contents before you begin the slice.

In the layer palette, the first is this small toolbar image. Lets make this a layer based slice, because we are not going to change its position and it is going to stay in one place.

The second is our main text ('The Complete Slice Tool'), remember we are going to replace this with our own HTML code (fig 1.0). Since we have two text and each one in a different layer and if you remember in our previous essential, if you select multiple layers and assigning layer based slice will make a slice for each of the individual layers. So the best option would be to user based slice.

The last is our 'Photoshop CS6' (the blue button), since we are going to assign an external link, lets make this a layer based slice. Because of the layer style, we'll leave this to photoshop to guess how far the slice has to go.

We don't need to slice the BG with pattern because, we are not going to separate the content from the BG. Photoshop is going to make an auto slice after we created our main slices. So we don't need to worry.

I assume you are following with me from the 1st essential in this series, Essential for Slice Select Tool 1

(fig 2.0)
(I have rasterized all the fonts (fig 2.0), so you don't have to worry about font issues, the exercise file will contain the exact same layer order and colors. Only the text layer is converted to normal layer which carries the same name)

If you notice (fig 3.0), Photoshop CS6 layer group has so many layers in the layer palette (left image). Just to keep things tidy, we are going to convert this to a 'Smart Objects'. Because layer based slice will also work on smart objects.

Remember the pros and cons for layer based slice we learned from >> Essential for Slice Select Tool 2

(fig 3.0)

Lets look at the full size toolbar with back button (fig 4.0). We are only going to assign the URL to the 'Back' button and apart from that we don't need to slice anything, the rest will be taken care by auto slice.

Since we are going to use only the back button with a simple rounded rectangle, and it has no layer style. We can use layer based slice. Select the BG and assign the layer based slice, do not select the text layer. 

(fig 4.0)

So here's all the slices (fig 5.0).

1. Banner (02, 04, and 07 are slice numbers)
(02) is our small toolbar with Layer based slice. (notice the symbol)
(04) is where we are going to place our own HTML, User based slice (notice the handles)
(07)  is layer based slice for our external webpage.
2. Notice the extra spaces are filled with auto slices.
3. Without auto slices
4. Full size toolbar with only 'back' button as layer based slice

(fig 5.0)

Now lets see our slice options, because this is where we are going to give all the information to each and individual slices. Photoshop is going to take these information and generate a HTML code for us, which we can view in a normal browser.

(fig 6.0)

Slice Options
Slice Type: Image, if you want to display the image as it is, then choose this option
Name: your slice name, keep it short and no space. HTML doesn't like spaces
Link: this is where you are going to put your link (local address or web address), and this particular slice will be treated as a button when you mouse over
Target: where you want the link to open?
_blank, which will open the link in a new tab/window
_self, will open in the same window
_parent, frameset element. where you have two or three frames and clicking the link will display the contents in the parent frame
_top, assigning top as a target will bring the content to the top of the frame in the frameset
Message Text: which holds the message when you mouse over, else it will display the URL in the status bar
Alt Tag: If the browser has any issue displaying your image, then this text will display instead
Dimensions: Coordinates and Dimensions (Locked for Layer Based Slice)
Slice Background Type: Background for the slice, you can see the background color if your image has alpha or if it is created with HTML code

Changing the Slice Type to 'No Image' (fig 6.1) will display the HTML text cell.

(fig 6.1)

You can open this 'Slice Options' window in three different ways
  1. Select the slice and click the 'Slice Options' from the options bar.
  2. Double-click the slice.
  3. Right-click and choose 'Edit Slice Options' from the context menu.

(fig 7.0)

Now that we have seen all the slice options and we have also sliced our contents. Lets add the text in the slice options.

Starting with the Full Size toolbar 'back' button, because this is easy to understand and we have only one slice to focus on. Select the 'Back' button with the slice select tool and use one of the method (fig 7.0) to open the slice options.

You can give any slice name you want (no spaces). Leave the URL empty because we need to link this to our main banner (the complete slice tool) and since its not ready, we'll come back to this again.

Set the target to '_self' because we need to open in the same window, you'll know what i mean once we finish everything and test it in a browser. You can fill the other details to match the content.

(fig 8.0)
  1. Go to File and select 'Save for Web' (fig 8.1)
  2. Once the window opens just press 'Save' at the bottom
  3. It will bring another Save Optimized As window.

(fig 8.1)

Select 'HTML and Images' as a format and for slices choose 'All Slices' (if not selected) and click 'Save' (fig 8.1)

Your saved content will have two files. One is a toolbar.html (fig 8.2) and another is a image folder which contain all the sliced images.

Open the toolbar.html in your browser, you should see a full toolbar with 'Back' button, just like the PSD file. If you mouse-over on the back button, your cursor should change into a 'hand' symbol, indicating that this is a link. of-course there is no URL so nothing happens when you click the button.

(fig 8.2)

Now lets do the same for the main banner. Open the the complete slice tool.psd and select small toolbar image slice and give the same text i've assigned here.

Note, for URL we can give 'toolbar.html' because when we click this image it should open that full size toolbar with back button and since we have already completed that, we know the name of the file.

Click 'OK'

(fig 9.0)

For 'The Complete Slice Tool', select the Slice Type to 'No Image' as a slice options and just type the same letters in the HTML code box. It's going to display the same text as output, but we'll fix it layer.

Click 'OK'

(fig 9.1)

The last in a row is our 'Photoshop CS6' button, give the URL photoshop.com. So when we click this, it will take us to the photoshop website.
URL
http://www.photoshop.com
Set your Target to blank (_blank) because we need to open the webpage in a separate window.

Click 'OK' to accept.

(fig 9.2)

Now lets save our slices, follow the same 'Save for web' options and in the 'Save Optimizes As' dialog box, make sure the location is the same.

Because in our URL we have given just the 'toolbar.html' (fig 9.0) which is the root, if you want to change the location then we need to mention the folder name. So for now just save it in the same location.

(fig 9.3)

We should see three files now. toolbar.html, banner.html and images. The images folder will contain all the slices.

(fig 9.4)

Open the banner.html and you will see something like this (fig 9.5). Notice the missing image of 'The Complete Slice Tool', what you see here is the HTML text we placed in the text cell.

(fig 9.5)

Lets open the 'Toolbar.psd' file and give the URL as the banner.html (remember we left this blank). Press 'OK' to accept changes. Now save the file as 'Save for web' (follow the same method, fig 8.1). when you save, it'll ask you whether you want to replace the images.

Click yes. 

(fig 10.0)

Now everything is ready. Open our banner.html. (fig 11.0) Click the small toolbar image (1), it should open the full size toolbar (2) and click the 'back' button at the bottom (3) and it will take you back to the banner again (4).

That's it, you have made your first HTML banner without any coding.

Now lets fix our simple HTML text, 'The Complete Slice Tool'

(fig 11.0)

Lets add the background color for our HTML text. Go to the slice options for 'The Complete Slice Tool' slice, and select the 'Slice Background Type' to 'Other..'.

Slice Background Type:
None: No color
Matte: Will assign the matt color. The color you can set from the Save for Web dialog box
White: Will have a white color
Black: Will have a black color
Other: Custom color

(fig 12.0)

I've selected light yellow (fig 12.0), you can select any color you want, and once you've done click 'OK' and go to file and select Save for web .

In the Save for web dialog box, click the 'Preview' at the bottom left will open a browser. You can see the changes without saving the file. And once you are happy, you can save the complete file in a folder for web (fig 8.1).

Currently i've set to Firefox, but you can set to any browser you want. Just select the arrow next to the preview button and select 'Others'.

(fig 12.1)

You should see a background color for the HTML text. Lets format this text.

(fig 12.2)

Save for Web dialog box will still be there (if you have clicked the preview button). Now lets open the slice options.

Do not close this window. Just select the slice select tool from the left (it'll be selected by default). Mouse-over on the slice, this will display a normal cursor. Double-click on 'The Complete Slice Tool' to open the slice options. 

(fig 13.0)

Now we can add our html text. This option box might look different from the one we saw from the slice select tool options menu. Instead of closing the 'Save for web' and going to the options bar and clicking the Slice Options. we can access it from here.

(fig 13.1)

Here's the two dialog box (fig 14.0). The extra option here is 'Cell Alignment'.

Cell Alignment will align the text inside the slice, else we need to insert manual HTML code.

'Text as HTML', if you do not check this option, then whatever code you type in the text cell will display the same in the browser with all the tags. It will treat all the code as simple text.

(fig 14.0)

Just copy this code and paste it in the HTML cell.
HTML Code
<p style="border: 1px solid black;
padding: 5px;
margin: 3px;">
The Complete Slice Tool
</p>

Code Explained
<p> </p>: opening and closing tag for paragraph 
style: stylizing our text (inline CSS)
border: adding 1 pixel solid black line around the text
padding: adding spaces between the text and the border
margin: adding extra spaces outside the border

In the drop-down for Cell Alignment select the horizontal to 'Center', this will align our text to center and vertical to middle.

Click 'OK' and press Preview at the bottom left to see the changes. Once you are happy with the result you can click save from the 'Save for Web' and save it in the same location (it'll warn your to replace the images, just select YES.)

(fig 15.0)

If you know a little HTML and CSS, you can make this 'The Complete Slice Tool' as a button and you can even bring this text to as close to the real design with adjusting the font-family and size and even adding a drop shadow.

I hope now you have learned all about slice tool and slice select tool and how useful it is for webdesign. So next time when you doing any website mockup design inside photoshop you know how to do the slicing and save them and also to add a little navigation to spice it up.

Note:
You can take full advantage of the image optimization with 'Save for Web' dialog box. Even though Save for Web and Slice tool goes hand in hand, the save for web has lot of features to cover and it can also be used for normal image optimization other than web. And everything involves understand of color.

I'll cover this as a separate essential >> Essentials for Save for Web

Photoshop CS6 - Essentials - The Slice Select Tool - III

06 January, 2013

This is a continuation from the previous essentials >> Essential for Slice Select Tool 2


In our last series we saw the basic of how slice works and stack order.
We will cover the rest in this essential.

(fig 1.0)

3. Promote
If you have created a slice from layer (layer based slice) or an auto slice which created automatically, you can click promote to User based slice.

Image below (fig 2.0), i've selected layer based slice (layer symbol) and auto slice (image+link in grey color). After i click the ‘Promote’ button from the options bar (fig 2.0 - 2) the layer based slice and the auto slice converts to User based slice (notice the 8 handles). You can also select multiple slices and click promote.

(fig 2.0)

You can also right-click on the Layer based slice or Auto Slice and select ‘Promote to User Slice’ from the context menu.

(fig 3.0)

When you convert the guides by clicking ‘Slice from Guides’ from the Slice tool options bar, it converts to User based slice. Learn more about Slice Tool >> Essential for Slice Tool

Note, you cannot promote subslice, because it doesn't really exist. It just there to show you the stacking order and to slice the image.

(fig 4.0)
 
There are four different ways you can promote auto slices (fig 4.0)

1. Selecting Promote from the options bar
2. 'Unlink Slices' from the optimize menu inside save for web dialog box
3. Selecting Divide will promote to user based slice
4. Selecting Slice options, (changing or adding any text and selecting 'OK' will also promote)

 4. Divide
Divide is one of the powerful option in the slice select tool. This is very useful for navigation menus, drop-down menus, tables, list items and also for image gallery.

Divide will add more sections to the slice, horizontally as well as vertically. Select the slice (fig 5.0)  and select 'Divide' from the options bar.

(fig 5.0)

If you do not see any sections, make sure 'Divide Horizontally Into' or 'Divide Vertically Into' is checked.
You can also right-click (fig 6.0) to open the context menu and select Divide Slice.

(fig 6.0)

Sections can be horizontal or vertical. You have to check the box (horizontal or vertical) to make it active.

(fig 7.0) The first option 'slices down, evenly spaced’ is useful to add horizontal sections that is constrained to the slice box. Note, this will not increase the overall slice box size instead it'll divide the existing slice.

Entering the number will display the result in the screen, make sure ‘Preview’ (below the cancel button)  is checked.

(fig 7.0)

The second option ‘pixels per slice’ (fig 7.0) does the same, the only difference is you can control how many pixels you need between each and every slices and it doesn't constrain to the box. The box doesn't expand, but the slice goes out

Try it out - Create a simple slice box
- Select the slice and click Divide from the options bar or right-click and choose from the context menu
- Use one of the options (vertical or horizontal) and select 'pixels per slice' and increase the number. 

You cannot control individual slice pixels, entering the value will give even spacing between each and every sections, starting from top.

(fig 8.0)

You can also reset the values anytime, by holding the 'Alt' key on your keyboard (fig 9.0). The Cancel button will switch to 'Reset', release the Alt key will toggle back to Cancel.

(fig 9.0)
If you are interested you can buy this keyboard, here)

I've made some couple of combinations with 'Divide Slice' window. You'll get an idea how it works and where you can use it.

This will work only on User based Slice.
To learn different types of slices, go here >> Essential for Slice Select Tool 2

(fig 10.0)

Alignment will align the guides with selected edges and distribute will distribute the slices evenly (fig 11.0). These are only for slices and not for the content with the layer.

Alignment and Distribute options will be covering more in-depth in Essentials for Move tool (will update once its ready)

(fig 11.0)

'Show Auto Slice' and 'Hide Auto Slice', will show or hide auto slices. If the slices are visible then the button will display 'Hide Auto Slices', if the slices are not visible then it will display 'Show Auto Slices' (fig 12.0).

Sometimes auto slices can get in your way when working with too many slices (user based slice/layer based slice). You can hide them by pressing this button, but you cannot delete them.

Even when you hide them, you can still select on any empty area and it will select the auto slice in that place. Remember, the button Hide or Show is only for slice visibility.

(fig 12.0)

Here's a comparison chart for all the slices
(fig 13.0)

The last option in a row is 'Slice Options'. Slice option will determine the behaviour for each and every slices and how they should respond when you open this in a browser.

By adding these information you can create a simple HTML banner. You don't need to go to any HTML editor, you can do everything inside photoshop. I'll teach you everything about this Slice Options in the next Essentials.

Next Essential >> Essential for Slice Select Tool 4