How do you avoid overlapping slices dividing each other?

Whats the best way to slice up a document into overlapping slices and have those slices not interfere with each other? By default (in ImageReady or FireWorks) when slices overlap, the top slice has precedence and the lower slice is divided into smaller slices for the area not being overlapped. I don’t want this to happed :pirate:

What I’ve been doing is saving out each slice individually raising it to the top most layer before exporting so that I get the whole thing. This is a painfully slow process though (or slower than it needs to be) and I was wondering if anyone knew a way to make that easier?

So the idea is to have full, overlapping slices which share common imagery to be exported completely as though they were the only slice.

anyone?

have you tried putting the over lap portion in a separate frame (in regards to fireworks not sure about IR)? Not completely sure I understand what you are doing tho.

slices are shared throughout frames.

What I want would be for 2 slices 100x100 px in size, which overlap, to be exported as 2 100x100 px images and not 1 100x100 px image and 2 other slices making up the intersection.

if you are using them in html why dont you export them as separate images then reassemble in your layering fashion using div tags since those support the stacking you are after

<div id="Layer1" style="position:absolute; left:46px; top:24px; width:287px; height:181px; z-index:1"></div>
<div id="Layer1" style="position:absolute; left:46px; top:24px; width:287px; height:181px; z-index:2"></div>

would layer 2 images on top of each other. And you caould manipulatet them with JS. SOrry if I am not being a help. But I know what you are trying cannot be done in FW.

got a image sample master sen???

not using HTML and it was the exporting itself I was trying get around, not what to do with the images afterwards.

I ended up just making a command to do it for me. :-\ works well enough though :beam:

and for grim :wink: Here’s what I meant:

eh go figure I sill do not understand what you were trying to accomplish and why but at least you got it

For anyone interested, this is the command Im using:

var dom = fw.getDocumentDOM();
var webLayerNum = dom.layers.length-1;
var webLayer = dom.layers[webLayerNum].frames[dom.currentFrameNum];
var slicesCount = webLayer.elements.length;
var filepath = fw.browseForFolderURL("Export To", dom.lastExportDirectory);
if (filepath != null){
	var i, slice, name, filename, sXO;
	for (i=0;i<slicesCount;i++){
		slice = webLayer.elements*;
		name = slice.baseName;
		if (name == null) name = "unnamed_slice_"+i;
		filename = filepath + "/" + name;
		sXO = slice.exportOptions;
		if (sXO == null) sXO = dom.exportOptions;
		sXO.crop = true;	
		sXO.cropLeft = slice.left - dom.left;
		sXO.cropRight = slice.left + slice.width - dom.left;
		sXO.cropTop = slice.top - dom.top;
		sXO.cropBottom = slice.top + slice.height - dom.top;
		fw.exportDocumentAs(dom, filename, sXO);
	}
}

If anyone wants I could package it :wink: but I won’t unless some one requests so (I don’t know how many other people would have a use for this - though Its good stuff to me)

…plus it might need tweakin, I don’t know if there are any problems with it or not… could be, never know.

ok I am really missing something what did you do? and what does it do? And why did you need the slices stacked. I feel like my life is incomplete cause I do not know what is going on :frowning:

Sen, I really don’t knwo to much javascript but I would save them as 2 seperate images and overlap them using css layers

*Originally posted by senocular *
not using HTML and it was the exporting itself I was trying get around, not what to do with the images afterwards.

I do not get it either.

in HTML, theres no point in overlapping images with divs/css if they’re just static images (asside from the possibility of those images being used in whole somewhere else on the page preventing the need for reload).

What slices do in programs like ImageReady and Fireworks is allow you do divide your images up into sections so that they can be exported as those sections and be placed into html (most likely via a table) in parts instead of a whole single image. Reasons for doing this include the need for non-image content within an area within an image or intersecting an image, like a text area in the middle of a portrait; or to divide an image up into portions which retain their own interactivity such as links and rollover effects.

Slices in this manner, because of their use in tables, disallow overlapping imagery. Well not so much disallow as compensate. Slices which overlap are reduced to smaller seperate slices based on the intersection of the overlapping. In an HTML environment, there’s no need for overlapping content to be used more than once since the screen is fairly static and there is no motion which would reveal the existence of the overlapping areas. So, because of that, ImageReady and Fireworks take the overlapping slices and transforms the lower slice into smaller slices that are positioned around the topmost slice to make up what portions of that lower slice is visible.

For example, here is an image which has two slices, one overlapping the other.

Here is the resulting html page
http://www.umbc.edu/interactive/fireworks/fullslices/testdeath.htm

You can see the lower slice was sliced and diced into smaller images because of the overlapping.

I am not exporting to HTML. I will not be using any HTML in what it is I’m doing. I am generating imagery for an interactive CD. And this imagery will be moving on the screen. I have my compositions built and I have divided my compositions into individual elements (slices) from which I would like to extract from that composition without making a new file or otherwise disrupting the compositions… composition. Some of these elements, however, as always is the case when I do these things, overlap, just in the same way as the example above. However, due to the nature of my circumstances, I do not want that slice division to occur from the overlapping which would just killing my nice new full slices. I needed a way to get those slices out of the document whole, again, with no HTML.

Before, as I mentioned, I would bring each slice to the top and export it individually. Afterall, as you saw in that example above, the top most slice is exported as a whole slice and the lower slices are divided. Given the complexity of my project, this could be slow and cumbersome so yesterday I decided to see if there was a better way. No one knew so I made my own :slight_smile:

Now, what that script I posted is, is javascript. It’s javascript which is to be run in the context of Fireworks aka a “command”. Commands in Fireworks are equivalent to Actions in Photoshop. They are what happens to make things… happen. In photoshop, you can record, save and use actions via an actions panel. In Fireworks, you don’t have an actions panel but you have a Commands menu giving you a list of installed commands to perform within your document. These commands are simply other javascript commands that interact with the Fireworks authoring program. They can be used to do pretty much all you can do with your mouse, just done through script. You can even see the commands of your actions within the program in the History panel in Fireworks. From there you can even copy a selection to the clipboard or save it to a file to re-use for later. Many extensions for Fireworks are just commands to extend the capabilities of Fireworks, much in the same way mine is.

What my script does is loops through each of the slices in the Web Layer and for each of those slices, exports the current Fireworks document (technically the ‘whole’ document) with the settings of the current slice in the loop iteration with a export crop based on the position of that slice within the document. This effectively exports each slice but in its entirety ignoring all overlapping compensation Fireworks would throw in there normally.

If it seems crazy, Ill tell you what I used this on yesterday (though this may not be the best example since frames could have been an solution but you might be able to see where this might be needed).

I’m currently working on an interactive CD for a local medical company which will be allowed to help doctors maintain board certification in viewing (and usually filling out some test or something in the end). In the introduction I have a few layers of randomly positioned question marks (4 layers total with about 4-5 question marks each) which are going to fly in from the bottom of the screen to eventually stop and make a still composition for the main menu. That still composition was created before any animation. In that animation, however, I’ll need to seperate those question marks into seperate images, one for each layer, so that they can move on the screen seperately. Those layers represent not only a different collection of question marks but also a different distance back in space so the lowest layer will move slower than the closest layer. Because of this difference in speed, theres also a difference in size. The closest layer is much taller than the furthest layer which is only the same height of the screen. The closest is around 2 or more times that hieght. And mind you these layers are also not all the same size and shape, some differ in other ways too.

Anywho, what I did was divide each layer of question marks into individual slices based on their size and shape. Sounds all fine and dandy until you export those slices. Since the slices all overlap, Fireworks will dry to do the division thing and mangle all but the topmost slice. In the codes of the previously posted command lies the solution. That command lets me export each slice as its own full image slice so that each image can then be brought into Director at the right shape and size and move as they need to be moved.

… there was another instance where I needed to divide letters up into slices and situations where you had character combinations like AV or anything with a y coming from beneath would cause slice overlapping in letters when they needed to be individually extracted. That had to be dealt with too - this would have been a good solution for that.

wow that is deep. But I thank you for the explanation. I did indeed learn something. I never make my own commands as you did. GJ my hat goes off to you for figuring that out. I would have bailed out and did it the long way.

:wink:

I ended up packaging it.

Just run the MXP and in Fireworks there will be a command in the Commands menu. It takes all slices and exports them into individual files ignoring overlapping and intersection.