Copy link to clipboard
Copied
Olá, pessoal! Primeira vez postando aqui. Não encontrei nada relacionado à minha dúvida, então decidi compartilhar.
Estou tentando criar um script para automatizar uma tarefa no Photoshop que envolve redimensionar formas e fontes em um arquivo de cotas. O problema é que, ao redimensionar a imagem de 3024x3024px para 1500x1500px, as fontes e formas ficam muito pequenas. Por exemplo, as linhas que têm altura de 1px no arquivo original ficam com 0,5px, e as setas que tinham altura e largura de 10px com traçado de 1,5px diminuem para 4,96px de altura/largura e 0,74px de espessura. As fontes também encolhem muito (antes eram 6pt e 4,7pt, mas depois ficam menores).
Já tentei selecionar todas as linhas e ajustar para 1px de altura, mas não funciona. Também tentei transformar as formas em objetos inteligentes, mas não deu certo.
Criei um script com a ajuda do ChatGPT, mas ele sempre retorna o erro 1320. Tentei dividir o script em partes, uma para as linhas, outra para as setas e uma para o texto, e consegui fazer funcionar só para o texto. As outras partes continuam gerando o erro 1320. Como tenho muitas imagens para ajustar, estou tentando uma solução mais rápida.
Vou deixar abaixo o script que tentei (mas que não funcionou) e também uma imagem de exemplo. Se alguém puder ajudar, seria ótimo! Agradeço desde já!
/* Script Photoshop JSX: Ajustar Altura das Formas para 1px via Transformar
Modifica diretamente a propriedade de altura da camada na aba Transformar.
Processa camada por camada individualmente para evitar erros. */
if (app.documents.length > 0) { var doc = app.activeDocument;
function setHeightToOnePixel(layer) {
if (layer.kind == LayerKind.SHAPE) {
// Seleciona a camada
doc.activeLayer = layer;
// Abre o painel de transformação
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
desc.putReference(charIDToTypeID("null"), ref);
// Define a nova altura como 1px
var heightDesc = new ActionDescriptor();
heightDesc.putUnitDouble(charIDToTypeID("Hght"), charIDToTypeID("#Pxl"), 1);
desc.putObject(charIDToTypeID("T "), charIDToTypeID("Trnf"), heightDesc);
// Aplica a transformação
executeAction(charIDToTypeID("setd"), desc, DialogModes.NO);
}
}
function processLayers(layerSet) {
for (var i = 0; i < layerSet.artLayers.length; i++) {
setHeightToOnePixel(layerSet.artLayers[i]);
}
// Processa subgrupos, se houver
for (var j = 0; j < layerSet.layerSets.length; j++) {
processLayers(layerSet.layerSets[j]);
}
}
processLayers(doc);
// Atualiza a visualização
app.refresh();
alert("Todas as linhas foram ajustadas para 1px de altura!");} else { alert("Nenhum documento aberto."); }
Copy link to clipboard
Copied
It's normal, if you size 50% everything will be resized to 50%, shapes, text and more,
what would you like to do?
resize the image and leave shapes and text the same size?
Copy link to clipboard
Copied
Yes, that's right. But in a way that keeps the dimension lines and arrows in the same place.
Copy link to clipboard
Copied
You could try but the result would not be consistent, because everything will be scaled and the lines and arrows will not.
Copy link to clipboard
Copied
I made a script for the fonts with gpt chat, but the lines and arrows don't work in the code. Can you help with the script for them?
Copy link to clipboard
Copied
Post a Psd file and we'll see if we can do something, I don't guarantee the result, It's just a test.
Copy link to clipboard
Copied
Ok! This file is 2654x2654px 300dpi, and I need to scale it to 1500x1500px 300dpi, but keep the lines, arrows and fonts with the same size (example: the lines are 1px high, the black arrows have 1.5px stroke, 10px width and 10px height, the red arrows are 10px high and 10px wide too. The fonts are in 6pt and also in 4.7pt in the part diameters. But I got the fonts from the script. I really appreciate your help in advance.
https://drive.google.com/file/d/1vtR4Mt5vySOttcWDDPXl78XeQPSaU9pE/view?usp=sharing
Copy link to clipboard
Copied
Hey, no rush at all, just wondering if you were able to work on the file?
Copy link to clipboard
Copied
Sorry, I've been busy with projects that are due lately and can't help you, if I get free I'll take a look.
Copy link to clipboard
Copied
It's a little confusing, but are you trying to re-mention a PSD file?
Copy link to clipboard
Copied
keep the size of shapes after re-mention the object
Copy link to clipboard
Copied
I tried some ideas unfortunately I couldn't create anything valid.
sorry.
Copy link to clipboard
Copied
thanks anyway for your time
Copy link to clipboard
Copied
and sorry my bad english, i'm brazilian. I study english but my level is B2
Copy link to clipboard
Copied
The google-link does not seem to work anymore, could you please provide the file again?
You seem to mix the terms shapes and strokes so I am not sure what the graphic elements actually are (Shape Layers with just Stroke, or Fill or Fill and Stroke).
Find more inspiration, events, and resources on the new Adobe Community
Explore Now