• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Script/rasterize() creates 2 images without apparent reason.

Participant ,
Jan 01, 2025 Jan 01, 2025

Copy link to clipboard

Copied

This has been puzzling me recently:

  • When I use rasterize() on my group with a resolution of up to 191dpi, it behaves as expected—the group is replaced by a single image object.
  • However, at 192dpi or higher, the group turns into two image objects: one "normal" and one blank.

It seems this issue relates to resolution size, as scaling the group down requires an even higher dpi for the problem to manifest.

You can replicate the issue by downloading my document. The script below will prompt you for a dpi value upon launch.

https://shared-assets.adobe.com/link/714aaccc-b774-47cd-48b8-43a24f04e870

 

 

 

function rastr() {
	var doc = app.activeDocument;
	var docLayers = doc.layers;
	var item = docLayers[0].groupItems[0];
	
	// 191 works. 192 creates two image objects for some reason?
	var rasterResolution = prompt("Raster Resolution:", "");
	
	// Raster Options
	var rasterOpts = new RasterizeOptions;
	rasterOpts.resolution = parseInt(rasterResolution);
	rasterOpts.antiAliasingMethod = AntiAliasingMethod.None;
	rasterOpts.backgroundBlack = false;
	rasterOpts.clippingMask = false;
	rasterOpts.colorModel = RasterizationColorModel.DEFAULTCOLORMODEL;
	rasterOpts.convertTextToOutlines = false;
	rasterOpts.includeLayers = false;
	rasterOpts.padding = 0;
	rasterOpts.transparency = false;
	rasterOpts.convertSpotColors = true;
	
	doc.rasterize (item,item.geometricBounds, rasterOpts);
}
rastr();

 

 

 

TOPICS
Scripting

Views

99

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Jan 01, 2025 Jan 01, 2025

Hi @iLLMonkey I can confirm your finding on AI 29.1 MacOS 15.2. It creates two images; one is just empty transparent pixels.

 

I will file a bug report. Also I've simplified the demo document (attached) to just two ordinary rectangles and modified your test code slightly just to be more targeted.

- Mark

 

 

(function () {

    var doc = app.activeDocument;
    var item = doc.groupItems[0];

    // Raster Options
    var rasterOpts = new RasterizeOptions;
    rasterOpts.resolution = 192;
    rast
...

Votes

Translate

Translate
Community Expert , Jan 01, 2025 Jan 01, 2025

I have lodged a bug report. Please vote to have it fixed.

Votes

Translate

Translate
Adobe
Community Expert ,
Jan 01, 2025 Jan 01, 2025

Copy link to clipboard

Copied

Hi @iLLMonkey I can confirm your finding on AI 29.1 MacOS 15.2. It creates two images; one is just empty transparent pixels.

 

I will file a bug report. Also I've simplified the demo document (attached) to just two ordinary rectangles and modified your test code slightly just to be more targeted.

- Mark

 

 

(function () {

    var doc = app.activeDocument;
    var item = doc.groupItems[0];

    // Raster Options
    var rasterOpts = new RasterizeOptions;
    rasterOpts.resolution = 192;
    rasterOpts.antiAliasingMethod = AntiAliasingMethod.None;
    rasterOpts.backgroundBlack = false;
    rasterOpts.clippingMask = false;
    rasterOpts.colorModel = RasterizationColorModel.DEFAULTCOLORMODEL;
    rasterOpts.convertTextToOutlines = false;
    rasterOpts.includeLayers = false;
    rasterOpts.padding = 0;
    rasterOpts.transparency = false;
    rasterOpts.convertSpotColors = true;

    doc.rasterize(item, item.geometricBounds, rasterOpts);

    var count = doc.rasterItems.length;

    if (count > 1)
        alert('The rasterization created two images but should have created only one.');

})();

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 01, 2025 Jan 01, 2025

Copy link to clipboard

Copied

LATEST

I have lodged a bug report. Please vote to have it fixed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines