@@ -7,6 +7,7 @@ import { type PortfolioState } from "@graphite/state-providers/portfolio";
7
7
import { makeKeyboardModifiersBitfield , textInputCleanup , getLocalizedScanCode } from "@graphite/utility-functions/keyboard-entry" ;
8
8
import { platformIsMac } from "@graphite/utility-functions/platform" ;
9
9
import { extractPixelData } from "@graphite/utility-functions/rasterization" ;
10
+ import { extractContent } from "@graphite/utility-functions/files"
10
11
import { stripIndents } from "@graphite/utility-functions/strip-indents" ;
11
12
import { updateBoundsOfViewports } from "@graphite/utility-functions/viewports" ;
12
13
import { type Editor } from "@graphite/wasm-communication/editor" ;
@@ -293,8 +294,12 @@ export function createInputManager(editor: Editor, dialog: DialogState, portfoli
293
294
}
294
295
295
296
if ( file . type . startsWith ( "image" ) ) {
296
- const imageData = await extractPixelData ( file ) ;
297
- editor . handle . pasteImage ( file . name , new Uint8Array ( imageData . data ) , imageData . width , imageData . height ) ;
297
+ if ( file . type === "image/x-sony-arw" ) {
298
+ editor . handle . pasteRawImage ( file . name , await extractContent ( file ) ) ;
299
+ } else {
300
+ const imageData = await extractPixelData ( file ) ;
301
+ editor . handle . pasteImage ( file . name , new Uint8Array ( imageData . data ) , imageData . width , imageData . height ) ;
302
+ }
298
303
}
299
304
300
305
if ( file . name . endsWith ( ".graphite" ) ) {
@@ -359,8 +364,12 @@ export function createInputManager(editor: Editor, dialog: DialogState, portfoli
359
364
const reader = new FileReader ( ) ;
360
365
reader . onload = async ( ) => {
361
366
if ( reader . result instanceof ArrayBuffer ) {
362
- const imageData = await extractPixelData ( new Blob ( [ reader . result ] , { type : imageType } ) ) ;
363
- editor . handle . pasteImage ( undefined , new Uint8Array ( imageData . data ) , imageData . width , imageData . height ) ;
367
+ if ( imageType === "image/x-sony-arw" ) {
368
+ editor . handle . pasteRawImage ( undefined , new Uint8Array ( reader . result ) ) ;
369
+ } else {
370
+ const imageData = await extractPixelData ( new Blob ( [ reader . result ] , { type : imageType } ) ) ;
371
+ editor . handle . pasteImage ( undefined , new Uint8Array ( imageData . data ) , imageData . width , imageData . height ) ;
372
+ }
364
373
}
365
374
} ;
366
375
reader . readAsArrayBuffer ( blob ) ;
0 commit comments