Skip to main content
Inspiring
July 24, 2026
Question

Slices Save for Web Format

  • July 24, 2026
  • 1 reply
  • 18 views

I have a JPG that I’m slicing up for email html. When I save for web it only saved one slice as my selected JPG output format, the other slices saved as PNG.

I’ve tried selecting all slices before save for web. I’ve tried selecting all slices in the save for web window. Nothing seems to enforce my intended output format of JPG.

Also, I have no idea why it’s choosing PNG. This image started life as a JPG. There is no transparency at all. This issue has been plaguing me for months!

here’s an old post on the subject...

 

    1 reply

    Stephen Marsh
    Community Expert
    Community Expert
    July 25, 2026

    @s15199d 

     

    I read the solutions at the link and don’t know why they didn’t work for you.

     

    Although not a direct answer, an alternative is to use a script to save all slices to JPEG.

     

    /* 
    https://community.adobe.com/t5/photoshop-ecosystem-discussions/can-slices-be-saved-at-300-ppi-in-photoshop/m-p/14272292
    v1.0 - 2nd December 2023, Stephen Marsh
    Based on a script from jazz-y
    https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-for-splitting-multiple-psds-to-defined-slices/m-p/12592481
    https://community.adobe.com/t5/photoshop-ecosystem-discussions/divide-my-image-to-layers/m-p/12467520
    */

    #target photoshop

    ///// ADDITION TO ORIGINAL CODE - START /////
    activeDocument.save();
    activeDocument.flatten();
    ///// ADDITION TO ORIGINAL CODE - END /////

    var s2t = stringIDToTypeID,
    AR = ActionReference,
    AD = ActionDescriptor;

    try {
    try {
    (r = new AR).putProperty(s2t('property'), p = s2t('layerID'));
    r.putEnumerated(s2t('layer'), s2t('ordinal'), s2t('targetEnum'));
    var id = executeActionGet(r).getInteger(p);
    } catch (e) {
    throw "No layer selected!\nOpen the document and select layer"
    }

    try {
    (r = new AR).putProperty(s2t('property'), p = s2t('slices'));
    r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
    var slices = executeActionGet(r).getObjectValue(p).getList(p);
    } catch (e) {
    throw "This version of photoshop does not have access to slices"
    }

    (r = new AR).putProperty(s2t('property'), p = s2t('resolution'));
    r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
    var res = executeActionGet(r).getDouble(p);

    (r = new AR).putProperty(s2t('property'), p = s2t('title'));
    r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
    var nm = executeActionGet(r).getString(p).replace(/\..+$/, '');

    try {
    (r = new AR).putProperty(s2t('property'), p = s2t('fileReference'));
    r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
    var pth = executeActionGet(r).getPath(p);
    } catch (e) {
    throw "File not saved!"
    }

    for (var i = 0; i < slices.count - 1; i++) {
    (r = new AR).putIdentifier(s2t('layer'), id);
    (d = new AD).putReference(s2t('target'), r);
    executeAction(s2t('select'), d, DialogModes.NO);

    (r = new AR).putProperty(s2t('channel'), s2t('selection'));
    (d = new AD).putReference(s2t('target'), r);
    d.putObject(s2t('to'), s2t('rectangle'),
    function (b, d) {
    for (var i = 0; i < b.count; i++)
    d.putUnitDouble(k = (b.getKey(i)), s2t('pixelsUnit'), b.getInteger(k))
    return d;
    }(slices.getObjectValue(i).getObjectValue(s2t('bounds')), new AD)
    );
    executeAction(s2t('set'), d, DialogModes.NO);

    try {
    (d = new AD).putString(s2t("copyHint"), "pixels");
    executeAction(s2t("copyEvent"), d, DialogModes.NO);

    (d = new AD).putClass(s2t("mode"), s2t("RGBColorMode"));
    d.putUnitDouble(s2t("width"), s2t("distanceUnit"), 1 * 72 / res);
    d.putUnitDouble(s2t("height"), s2t("distanceUnit"), 1 * 72 / res);
    d.putUnitDouble(s2t("resolution"), s2t("densityUnit"), res);
    d.putEnumerated(s2t("fill"), s2t("fill"), s2t("white"));
    d.putInteger(s2t("depth"), 8);
    d.putString(s2t("profile"), "sRGB IEC61966-2.1");
    (d1 = new AD).putObject(s2t("new"), s2t("document"), d);
    executeAction(s2t("make"), d1, DialogModes.NO);

    (d = new AD).putEnumerated(s2t("antiAlias"), s2t("antiAliasType"), s2t("antiAliasNone"));
    d.putClass(s2t("as"), s2t("pixel"));
    executeAction(s2t("paste"), d, DialogModes.NO);

    executeAction(s2t("revealAll"), new AD, DialogModes.NO);
    executeAction(s2t("flattenImage"), undefined, DialogModes.NO);

    ///// ADDITION TO ORIGINAL CODE - START /////
    var actDesc = new ActionDescriptor();
    var idextendedQuality = stringIDToTypeID("extendedQuality");
    actDesc.putInteger(idextendedQuality, 12); // 0-12
    (d = new AD).putObject(s2t("as"), s2t("JPEG"), actDesc, new AD);
    d.putPath(s2t("in"), File(pth.path + '/' + nm + ' ' + ('0' + i).slice(-2) + '.jpg'));
    d.putEnumerated(s2t("saveStage"), s2t("saveStageType"), s2t("saveBegin"));
    executeAction(s2t("save"), d, DialogModes.NO);
    ///// ADDITION TO ORIGINAL CODE - END /////

    executeAction(s2t("close"), new AD, DialogModes.NO);

    (r = new AR).putProperty(s2t('channel'), s2t('selection'));
    (d = new AD).putReference(s2t('null'), r);
    d.putEnumerated(s2t('to'), s2t('ordinal'), s2t('none'));
    executeAction(s2t('set'), d, DialogModes.NO);
    } catch (e) {
    throw e + "\nScript cannot create layer from empty space!\nMake sure that current layer contains pixels in all slices."
    }
    }
    } catch (e) {
    alert(e)
    }


    ///// ADDITION TO ORIGINAL CODE - START /////
    executeAction(stringIDToTypeID("revert"), undefined, DialogModes.NO);
    ///// ADDITION TO ORIGINAL CODE - END /////

     

    1. Copy the code text to the clipboard
    2. Open a new blank file in a plain-text editor (not in a word processor)
    3. Paste the code in
    4. Save as a plain text format file – .txt
    5. Rename the saved file extension from .txt to .jsx
    6. Install or browse to the .jsx file to run (see below)

    https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html