Skip to main content
Known Participant
August 10, 2024
Question

Black horizontal line across the image after save to tif

  • August 10, 2024
  • 5 replies
  • 5751 views

Hi

 

I edited raw image & saved to tiff.  I had experience black horizontal line across the image.  

Sometimes it appeared & I had to redo again.

(MacOS Sonoma 14.4.1)

 

Please help

 

 

    5 replies

    Stephen Marsh
    Community Expert
    Community Expert
    March 7, 2025

    Apart from using Adobe Bridge or another visual method to eyeball the results, it's possible to script this to various degrees. The following script will check selected files for pure black pixels and write the suspect file names and paths to a text file on the desktop. For processing speed, it will make a temporary crop of the canvas width to 3px wide before checking the histogram, which may not always be perfect and could lead to some false-positives being reported. Checking row by row for continuous black pixels would be very time prohibitive, even if downsampling and/or cropping to help speed things up.

     

    /*
    Log Files With Black Full Width Line to Text File Fast.jsx
    Stephen Marsh
    v1.0 - 7th March 2025
    https://community.adobe.com/t5/photoshop-ecosystem-discussions/black-horizontal-line-across-the-image-after-save-to-tif/m-p/15195817
    Note: It is assumed that the documents are RGB mode
    */
    
    #target photoshop
    
    // Open dialog to select files
    var theFiles = File.openDialog("Select files to check for full width 0r0g0b pixels", true);
    
    if (theFiles) {
        processFiles(theFiles);
    } else {
        alert("No files selected.");
    }
    
    // Function to check histogram for 0r0g0b
    function checkHistogramForBlack(doc) {
        var histo = doc.histogram;
        return histo[0] > 0;
    }
    
    // Function to process files
    function processFiles(theFiles) {
        var resultFile = new File(Folder.desktop + "/BlackPixelsCheckResults.txt");
        resultFile.open("w");
        resultFile.writeln("Files possibly containing full width 0r0g0b pixels:\n");
    
        // Counter for files with 0r0g0b pixels
        var blackFilesCount = 0;
    
        // Loop through files
        for (var i = 0; i < theFiles.length; i++) {
            var theFile = theFiles[i];
            var doc = app.open(theFile);
    
            // Resize canvas to 3px wide, yes it's a hack but it works much faster than looping through all pixels...
            // Some edge cases could be falsely logged, but it's probably good enough for most cases!
            doc.resizeCanvas(UnitValue(3, "px"), doc.height, AnchorPosition.MIDDLECENTER);
    
            if (checkHistogramForBlack(doc)) {
                resultFile.writeln(theFile.fsName);
                blackFilesCount++; // Increment counter when 0r0g0b pixels are found
            }
            doc.close(SaveOptions.DONOTSAVECHANGES);
        }
    
        // End of script notification
        resultFile.close();
        alert("Processing complete!\n" + "Total files checked: " + theFiles.length + "\n" +
            "Files with possible full width black pixels: " + blackFilesCount + "\n" +
            "Results saved to: " + resultFile.fsName);
        resultFile.execute();
    
    }

     

    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

    Stephen Marsh
    Community Expert
    Community Expert
    March 8, 2025

    Here's a slightly different take on the previous script, this one leverages colour range to load all pure black pixels as a selection and then compares the selection width to the document width. If both match, then the file is logged as possibly containing a black row. As with the previous code, this isn't perfect and there may be cases where false positives are flagged.

     

    /*
    Log Files With Black Full Width Line to Text File Slower.jsx
    Stephen Marsh
    v1.0 - 8th March 2025
    https://community.adobe.com/t5/photoshop-ecosystem-discussions/black-horizontal-line-across-the-image-after-save-to-tif/m-p/15195817
    */
    
    #target photoshop
    
    // Open dialog to select files
    var theFiles = File.openDialog("Select files to check for full width 0r0g0b pixels", true);
    
    if (theFiles) {
        processFiles(theFiles);
    } else {
        alert("No files selected.");
    }
    
    // Function to check histogram for 0r0g0b
    function checkHistogramForBlack(doc) {
        var histo = doc.histogram;
        return histo[0] > 0;
    }
    
    function selectColorRange(fuzziness, luminance, a, b, luminance2, a2, b2, colorModel) {
        var s2t = function (s) {
            return app.stringIDToTypeID(s);
        };
        var descriptor = new ActionDescriptor();
        var descriptor2 = new ActionDescriptor();
        var descriptor3 = new ActionDescriptor();
        descriptor.putInteger(s2t("fuzziness"), fuzziness);
        descriptor2.putDouble(s2t("luminance"), luminance);
        descriptor2.putDouble(s2t("a"), a);
        descriptor2.putDouble(s2t("b"), b);
        descriptor.putObject(s2t("minimum"), s2t("labColor"), descriptor2);
        descriptor3.putDouble(s2t("luminance"), luminance2);
        descriptor3.putDouble(s2t("a"), a2);
        descriptor3.putDouble(s2t("b"), b2);
        descriptor.putObject(s2t("maximum"), s2t("labColor"), descriptor3);
        descriptor.putInteger(s2t("colorModel"), colorModel);
        executeAction(s2t("colorRange"), descriptor, DialogModes.NO);
    }
    
    function processFiles(theFiles) {
        var resultFile = new File(Folder.desktop + "/BlackPixelsCheckResults.txt");
        resultFile.open("w");
        resultFile.writeln("Files possibly containing full width 0r0g0b pixels:\n");
    
        // Counter for files with 0r0g0b pixels
        var blackFilesCount = 0;
    
        // Loop through files
        for (var i = 0; i < theFiles.length; i++) {
            var theFile = theFiles[i];
            var doc = app.open(theFile);
    
            selectColorRange(0, 0, 0, 0, 0, 0, 0, 0);
    
            var selectionBounds = activeDocument.selection.bounds;
            var selectionWidth = selectionBounds[2].as("px") - selectionBounds[0].as("px");
            if (app.activeDocument.width.as("px") === selectionWidth) {
                resultFile.writeln(theFile.fsName);
                blackFilesCount++; // Increment counter when 0r0g0b pixels are found
            }
    
            doc.close(SaveOptions.DONOTSAVECHANGES);
        }
    
        // End of script notification
        resultFile.close();
        alert("Processing complete!\n" + "Total files checked: " + theFiles.length + "\n" +
            "Files with possible full width black pixels: " + blackFilesCount + "\n" +
            "Results saved to: " + resultFile.fsName);
        resultFile.execute();
    
    }
    Stephen Marsh
    Community Expert
    Community Expert
    March 6, 2025

    Try Saving to the internal drive and then copy it to the external drive.

     

    https://helpx.adobe.com/au/photoshop/kb/networks-removable-media-photoshop.html

    Participant
    March 6, 2025

    Right. Easier said than done depending on workload and internal storage. Adobe also says "Adobe is not stating that there should be regular problems storing files and working with external hard disks. " Seems like Adobe is trying to have its cake and eat it to. It's almost like saying try Rawtherapee or DXO. 

    Participant
    March 7, 2025
    quote

    Right. Easier said than done depending on workload and internal storage. Adobe also says "Adobe is not stating that there should be regular problems storing files and working with external hard disks. " Seems like Adobe is trying to have its cake and eat it to. It's almost like saying try Rawtherapee or DXO. 


    By @Kovich24


    I would presume that other software would have the same issue. If not, you have your answer:

     

    1) save locally and move to removable storage

     

    2) save directly to removable storage and be prepared to double check and re-render when necessary

     

    3) use other software if that proves to be problem free or less problematic 

     


    Thanks for the script (other post), and options noted. I appreciate the help. In Astro, there are a lot of intermediate files that you eventually delete. But, this also means I"m looking at each exposure, so the script would help ensure no misses. 

    Stephen Marsh
    Community Expert
    Community Expert
    March 5, 2025

    To all experiencing this issue, are you saving direct to your computer's local drive, or are you saving over the network or to cabled external media?

    Gin TayAuthor
    Known Participant
    March 6, 2025

    I saved my file into external hard disk.  I have been doing this from few years.  

    kglad
    Community Expert
    Community Expert
    August 10, 2024

    in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

    p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



    <"moved from using the community">
    Gin TayAuthor
    Known Participant
    August 13, 2024

    Please Help

    Sameer K
    Community Manager
    Community Manager
    August 13, 2024

    Hey, @Gin Tay. Welcome to the Photoshop Community. I'll need more info to help you figure this out. Please share the system info from Photoshop Help > System info > Copy & paste into a text document > upload & attach here. 

     

    Do you notice this line when you preview the image after exporting it? Does it appear to have the black strip after you open the image back in Photoshop? Has this started to happen since a recent update of Photoshop, or the operating system.

     

    Please share a series of screenshots how you save the file as TIF from Photoshop.

     

    Thanks!

    Sameer K

    (Use '@mention' to tag me when you reply)

    kglad
    Community Expert
    Community Expert
    August 10, 2024

    what app?

    Gin TayAuthor
    Known Participant
    August 10, 2024

    Adobe Photoshop 2024

    Gin TayAuthor
    Known Participant
    August 10, 2024

    here is another image with black horizotal line.