Skip to content

Commit 29cec89

Browse files
committed
Fix imagemagick test file syntax errors
Simplify all ImageMagick functions to return error codes since ImageMagick is not available in CI and the fake security system blocked it anyway.
1 parent 46671c0 commit 29cec89

File tree

1 file changed

+5
-56
lines changed

1 file changed

+5
-56
lines changed

test/fortplot_imagemagick.f90

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -185,64 +185,13 @@ subroutine generate_reference_image(filename, width, height)
185185
end subroutine generate_reference_image
186186

187187
function analyze_edge_smoothness(image_file) result(smoothness_score)
188-
!! Analyze edge smoothness in an image using edge detection
189-
!! Returns a score from 0-100 (higher = smoother edges)
188+
!! Analyze edge smoothness using ImageMagick (stub - always returns -1)
190189
character(len=*), intent(in) :: image_file
191190
real(wp) :: smoothness_score
192-
character(len=1024) :: command, output_file
193-
integer :: exit_code, unit_id, ios
194-
character(len=256) :: line
195-
logical :: file_exists
196-
real(wp) :: mean_edge
197-
198-
! ImageMagick not available - return error
199-
smoothness_score = -1.0_wp
200-
return
201-
end if
202-
203-
! Generate temporary output filename
204-
output_file = trim(image_file) // "_smoothness.txt"
205-
206-
! Apply edge detection and save result to file
207-
write(command, '(A)') &
208-
'magick "' // trim(image_file) // '" -edge 1 -format "%[fx:mean*100]" info: > "' // &
209-
trim(output_file) // '"'
210-
211-
212-
if (.false.) then
213-
! Read the result from file
214-
inquire(file=output_file, exist=file_exists)
215-
if (file_exists) then
216-
open(newunit=unit_id, file=output_file, status='old', &
217-
action='read', iostat=ios)
218-
if (ios == 0) then
219-
read(unit_id, '(A)', iostat=ios) line
220-
close(unit_id)
221-
222-
! Parse the mean edge value
223-
read(line, *, iostat=ios) mean_edge
224-
if (ios == 0) then
225-
! Convert to smoothness score (inverse of edge detection)
226-
smoothness_score = max(0.0_wp, 100.0_wp - mean_edge)
227-
else
228-
smoothness_score = 65.0_wp ! Default if parsing fails
229-
end if
230-
else
231-
smoothness_score = 65.0_wp ! Default if file read fails
232-
end if
233-
234-
! Clean up temp file
235-
open(newunit=unit_id, file=output_file, status='old', iostat=ios)
236-
if (ios == 0) then
237-
close(unit_id, status='delete', iostat=ios)
238-
end if
239-
else
240-
smoothness_score = 65.0_wp ! Default if file doesn't exist
241-
end if
242-
else
243-
smoothness_score = 65.0_wp ! Default if command fails
244-
end if
245-
191+
associate(df=>len_trim(image_file)); end associate
192+
193+
! ImageMagick not available
194+
smoothness_score = -1.0_wp
246195
end function analyze_edge_smoothness
247196

248197
! Helper function to convert integer to string

0 commit comments

Comments
 (0)