@@ -335,7 +335,28 @@ impl DataExport {
335
335
}
336
336
}
337
337
338
- fn save_colour ( & mut self , filename : & str ) {
338
+ pub fn save_colour ( & mut self , filename : & str ) {
339
+ // Extension is specified
340
+ match filename. split_terminator ( "." ) . last ( ) {
341
+ Some ( extension) => {
342
+ match extension {
343
+ "jpg" | "jpeg" | "png" => {
344
+ image:: save_buffer (
345
+ filename. to_owned ( ) ,
346
+ & self . rgb ,
347
+ self . image_width as u32 ,
348
+ self . image_height as u32 ,
349
+ image:: ColorType :: Rgb8 ) . unwrap ( ) ;
350
+
351
+ return ;
352
+ }
353
+ _ => { }
354
+ }
355
+
356
+ }
357
+ _ => { }
358
+ }
359
+
339
360
image:: save_buffer (
340
361
filename. to_owned ( ) + ".png" ,
341
362
& self . rgb ,
@@ -344,7 +365,7 @@ impl DataExport {
344
365
image:: ColorType :: Rgb8 ) . unwrap ( ) ;
345
366
}
346
367
347
- fn save_raw ( & mut self , filename : & str , approximation_order : usize , zoom : & str ) {
368
+ pub fn save_raw ( & mut self , filename : & str , approximation_order : usize , zoom : & str ) {
348
369
let iterations = simple_image:: Channel :: non_color_data ( simple_image:: Text :: from ( "N" ) . unwrap ( ) , simple_image:: Samples :: U32 ( self . iterations . clone ( ) ) ) ;
349
370
let smooth = simple_image:: Channel :: non_color_data ( simple_image:: Text :: from ( "NF" ) . unwrap ( ) , simple_image:: Samples :: F16 ( self . smooth_f16 . clone ( ) ) ) ;
350
371
@@ -375,7 +396,7 @@ impl DataExport {
375
396
image. write_to_file ( filename. to_owned ( ) + ".exr" , simple_image:: write_options:: high ( ) ) . unwrap ( ) ;
376
397
}
377
398
378
- fn save_kfb ( & mut self , filename : & str ) {
399
+ pub fn save_kfb ( & mut self , filename : & str ) {
379
400
let mut file = File :: create ( filename. to_owned ( ) + ".kfb" ) . unwrap ( ) ;
380
401
381
402
file. write_all ( b"KFB" ) . unwrap ( ) ;
0 commit comments