Bitmap/Read a PPM file: Difference between revisions
Content added Content deleted
(Added PicoLisp) |
(→{{header|PureBasic}}: Added task completion) |
||
Line 835: | Line 835: | ||
EndSelect |
EndSelect |
||
StopDrawing() |
StopDrawing() |
||
; Return 1 if successfully loaded to behave as other |
; Return 1 if successfully loaded to behave as other PureBasic functions |
||
ProcedureReturn 1 |
ProcedureReturn 1 |
||
EndIf |
EndIf |
||
EndIf |
EndIf |
||
EndProcedure</lang> |
EndProcedure</lang> |
||
To complete the task, the following code should be added to the above fragment and to the PureBasic solutions for [[Grayscale_image#PureBasic|Grayscale image]] and [[Bitmap/Write_a_PPM_file#PureBasic|Write a PPM file]] |
|||
<lang PureBasic>Define file, file2.s, image = 3 |
|||
file = OpenFileRequester("Select source image file", "*.ppm", "PPM image (*.ppm)|PPM", 0) |
|||
If file And LCase(GetExtensionPart(file)) = ".ppm" |
|||
LoadImagePPM(image, file) |
|||
ImageGrayout(image) |
|||
file2 = Left(file, Len(file) - Len(GetExtensionPart(file))) + "_grayscale." + GetExtensionPart(file) |
|||
SaveImageAsPPM(image, file2, 1) |
|||
EndIf</lang> |
|||
=={{header|Python}}== |
=={{header|Python}}== |