Document
DOCUMENT HELPERS
NO_DIALOG = DialogModes.DisplayNoDialogs
module-attribute
DOCUMENT HIERARCHY
check_active_document()
Checks if there are any active documents loaded in Photoshop. @return: True if exists, otherwise False.
Source code in src/helpers/document.py
228 229 230 231 232 233 234 235 236 237 238 |
|
close_document()
Close the active document.
Source code in src/helpers/document.py
343 344 345 |
|
get_document(name)
Check if a Photoshop Document has been loaded. @param name: Filename of the document. @return: The Document if located, None if missing.
Source code in src/helpers/document.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
|
get_layer_tree(group=None)
Composes a dictionary tree of layers in the active document or a specific LayerSet. @param: A specific group to create a dictionary tree for. @return: A dictionary tree comprised of all the layers in a document or group.
Source code in src/helpers/document.py
51 52 53 54 55 56 57 58 59 60 61 62 |
|
get_leaf_layers(group=None)
Utility function to generate a list of leaf layers in a LayerSet or document. @param group: Group to grab leaf layers from. @return: A list of leaf layers in a LayerSet or document.
Source code in src/helpers/document.py
37 38 39 40 41 42 43 44 45 46 47 48 |
|
import_art(layer, file, name='Layer 1')
Imports an art file into the active layer. @param layer: Layer to make active and receive image. @param file: Image file to import. @param name: Name of the new layer.
Source code in src/helpers/document.py
70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
import_art_into_new_layer(file, name='New Layer')
Creates a new layer and imports a given art into that layer. @param file: Image file to import, must have a valid image extension. @param name: Chosen name of the new layer.
Source code in src/helpers/document.py
138 139 140 141 142 143 144 |
|
import_svg(file, ref=None, placement=None)
Imports an SVG image, then moves it if needed. @param file: SVG file to import. @param ref: Reference used to move layer. @param placement: Placement based on the reference. @return: New layer containing SVG.
Source code in src/helpers/document.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
jump_to_history_state(position)
Jump to a position in the history state relative to its current position. 2 moves forward two, -2 moves backwards two. @param position: Integer value determining how far ahead or behind in the state to move.
Source code in src/helpers/document.py
152 153 154 155 156 157 158 159 160 161 162 |
|
paste_file(layer, file, action=None, action_args=None)
Pastes the given file into the specified layer. @param layer: Layer object to paste the image into. @param file: Filepath of the image to open. @param action: Optional action function to call on the image before importing it. @param action_args: Optional arguments to pass to the action function
Source code in src/helpers/document.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
pixels_to_points(number)
Converts a given number in pixel units to point units. @param number: Number represented in pixel units. @return: Float representing the given value in point units.
Source code in src/helpers/document.py
219 220 221 222 223 224 225 |
|
points_to_pixels(number)
Converts a given number in point units to pixel units. @param number: Number represented in point units. @return: Float representing the given value in pixel units.
Source code in src/helpers/document.py
210 211 212 213 214 215 216 |
|
redo_action()
Redo the last action undone in the history state.
Source code in src/helpers/document.py
184 185 186 187 188 |
|
reset_document()
Reset to the history state to when document was first opened.
Source code in src/helpers/document.py
191 192 193 194 195 196 197 198 199 200 201 202 |
|
rotate_clockwise()
Utility definition for rotating 90 degrees clockwise.
Source code in src/helpers/document.py
371 372 373 |
|
rotate_counter_clockwise()
Utility definition for rotating 90 degrees counter-clockwise.
Source code in src/helpers/document.py
366 367 368 |
|
rotate_document(angle)
Rotate the document. @param angle: Angle to rotate the document.
Source code in src/helpers/document.py
353 354 355 356 357 358 359 360 361 362 363 |
|
rotate_full()
Utility definition for rotating a full 180 degrees.
Source code in src/helpers/document.py
376 377 378 |
|
save_document_jpeg(path, optimize=True)
Save the current document as a JPEG. @param path: Path to save the JPEG file. @param optimize: Whether to save with "Optimize Baseline". Reduces file size, but may cause an error on older versions of Photoshop.
Source code in src/helpers/document.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
|
save_document_png(path)
Save the current document as a PNG. @param path: Path to save the PNG file.
Source code in src/helpers/document.py
280 281 282 283 284 285 286 287 288 289 290 291 |
|
save_document_psb(path)
Save the current document as a PSB. @param path: Path to save the PSB file.
Source code in src/helpers/document.py
329 330 331 332 333 334 335 336 337 338 339 340 |
|
save_document_psd(path)
Save the current document as a PSD. @param path: Path to save the PSD file.
Source code in src/helpers/document.py
317 318 319 320 321 322 323 324 325 326 |
|
toggle_history_state(direction='previous')
Alter the history state. @param direction: Direction to move the history state ("previous" or "next").
Source code in src/helpers/document.py
165 166 167 168 169 170 171 172 173 174 |
|
trim_transparent_pixels()
Trim transparent pixels from Photoshop document.
Source code in src/helpers/document.py
262 263 264 265 266 267 268 269 270 271 272 |
|
undo_action()
Undo the last action in the history state.
Source code in src/helpers/document.py
177 178 179 180 181 |
|