Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GoikLectures
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Goik Martin
GoikLectures
Commits
9aab3e2f
Commit
9aab3e2f
authored
9 years ago
by
Goik Martin
Browse files
Options
Downloads
Patches
Plain Diff
pdftoppm is now required for fig --> png conversion
parent
85278488
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+3
-1
3 additions, 1 deletion
Makefile
bin/figspecial2png
+38
-27
38 additions, 27 deletions
bin/figspecial2png
with
41 additions
and
28 deletions
Makefile
+
3
−
1
View file @
9aab3e2f
...
@@ -2,7 +2,9 @@ SHELL = /bin/bash
...
@@ -2,7 +2,9 @@ SHELL = /bin/bash
numCores
=
$(
shell
nproc
--all
)
numCores
=
$(
shell
nproc
--all
)
EXECUTABLES
=
/usr/share/xmlmind/bin/xxetool rsync pdflatex convert figspecial2pdf figspecial2png figspecial2svg fig2dev fig2mpdf fig2pdf pdf2svg java avconv
EXECUTABLES
=
/usr/share/xmlmind/bin/xxetool rsync pdflatex convert figspecial2pdf figspecial2png figspecial2svg fig2dev fig2mpdf fig2pdf pdf2svg pdftoppm
\
java avconv
K
:=
$(
foreach
exec
,
$(
EXECUTABLES
)
,
\
K
:=
$(
foreach
exec
,
$(
EXECUTABLES
)
,
\
$(
if
$(
shell which
$(
exec
))
,some string,
$(
error
"No
$(
exec
)
in PATH
)))
$(
if
$(
shell which
$(
exec
))
,some string,
$(
error
"No
$(
exec
)
in PATH
)))
...
...
This diff is collapsed.
Click to expand it.
bin/figspecial2png
+
38
−
27
View file @
9aab3e2f
...
@@ -3,44 +3,55 @@
...
@@ -3,44 +3,55 @@
use
strict
;
use
strict
;
my
$args
=
join
('
:
',
@ARGV
);
#print "figspecial2png $args \n";
#system("pwd >> /tmp/figresult");
my
$argCount
=
$#ARGV
;
my
$argCount
=
$#ARGV
;
my
$tmpDir
=
'
/tmp/gendir
';
if
(
1
!=
$argCount
)
{
if
(
1
!=
$argCount
)
{
die
"
usage: figspecial2png figFile pngFile
"
;
die
"
usage: figspecial2png figFile pngFile
"
;
}
else
{
my
(
$figFileName
,
$pngResultFileName
)
=
@ARGV
;
my
$figFileBasename
=
$figFileName
;
$figFileBasename
=~
s/\.fig$//
;
system
("
fig2pdf --nogv
$figFileName
");
system
("
pdftoppm -singlefile -png
$figFileBasename
.pdf >
$pngResultFileName
&& rm -f
$figFileBasename
.pdf
");
}
}
my
(
$figFileName
,
$pngResultFileName
)
=
@ARGV
;
#my $args= join(':', @ARGV);
my
@pathComponents
=
split
('
/
',
$figFileName
);
#print "figspecial2png $args \n";
my
(
$figFileBasename
)
=
$pathComponents
[
$#pathComponents
];
#system("pwd >> /tmp/figresult");
$figFileBasename
=~
s/\.fig$//
;
my
(
$figFileBasedir
)
=
join
('
/
',
@pathComponents
[
0
..
$#pathComponents
-
1
]);
my
$generateDir
=
$tmpDir
.
$figFileBasedir
;
#my $argCount = $#ARGV;
my
$pngGenerateFile
=
$generateDir
.
'
/
'
.
$figFileBasename
.
'
.png
';
#my $tmpDir = '/tmp/gendir';
my
$pdfGenerateFile
=
$generateDir
.
'
/
'
.
$figFileBasename
.
'
.pdf
';
#if (1 != $argCount) {
# die "usage: figspecial2png figFile pngFile" ;
#}
if
((
-
r
$pngGenerateFile
)
&&
((
stat
(
$pngGenerateFile
))[
9
]
>
(
stat
(
$figFileName
))[
9
]))
{
#my ($figFileName, $pngResultFileName) = @ARGV;
#my @pathComponents = split('/', $figFileName);
#my ($figFileBasename) = $pathComponents[$#pathComponents];
#$figFileBasename =~ s/\.fig$//;
#my ($figFileBasedir) = join('/', @pathComponents[0..$#pathComponents-1]);
#my $generateDir = $tmpDir . $figFileBasedir;
#my $pngGenerateFile = $generateDir . '/' . $figFileBasename . '.png';
#my $pdfGenerateFile = $generateDir . '/' . $figFileBasename . '.pdf';
#if ((-r $pngGenerateFile) && ((stat($pngGenerateFile))[9] > (stat($figFileName))[9])) {
# print $pngGenerateFile , " exists and is newer than ", $figFileName, "\n";
# print $pngGenerateFile , " exists and is newer than ", $figFileName, "\n";
}
else
{
#
} else {
# print $pngGenerateFile , " does not exist or is older than $figFileName\n";
# print $pngGenerateFile , " does not exist or is older than $figFileName\n";
&execCmd
("
mkdir -p
"
.
$generateDir
);
#
&execCmd("mkdir -p " . $generateDir);
my
$convertResult
=
&execCmd
("
fig2dev -L pstex
$figFileName
| epstopdf -f >
$pdfGenerateFile
");
#
my $convertResult = &execCmd("fig2dev -L pstex $figFileName | epstopdf -f > $pdfGenerateFile");
if
(
1
==
$argCount
&&
0
==
$convertResult
)
{
#
if (1 == $argCount && 0 == $convertResult) {
&execCmd
("
convert
"
.
$pdfGenerateFile
.
"
"
.
$pngGenerateFile
);
#
&execCmd("convert " . $pdfGenerateFile . " " . $pngGenerateFile);
}
#
}
}
#
}
&execCmd
("
cp
"
.
$pngGenerateFile
.
'
'
.
$pngResultFileName
);
#
&execCmd("cp " . $pngGenerateFile . ' ' . $pngResultFileName);
sub
execCmd
{
#
sub execCmd {
my
(
$cmd
)
=
@_
;
#
my ($cmd) = @_;
# system("echo ---'$cmd' >> /tmp/figresult");
# system("echo ---'$cmd' >> /tmp/figresult");
return
system
("
cd /tmp;
$cmd
2>>/tmp/figresult
");
#
return system("cd /tmp;$cmd 2>>/tmp/figresult");
}
#
}
;
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment