Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gia-ast

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gia-ast - npm Package Compare versions

Comparing version 0.1.14 to 0.1.15

test-seq-creator-multires.sh

144

gia-ast.js

@@ -16,2 +16,4 @@ #!/bin/env node

const fs = require('fs');
const tempfile = require('tempfile');
const sharp = require('sharp');

@@ -22,2 +24,60 @@

//----for later
// const yargs = require('yargs');
// var ver = yargs.version();
// var appStartMessage =
// `Multi platform Contact Sheet maker
// By Guillaume Descoteaux-Isabelle, 2020-2021
// version ${ver}
// ----------------------------------------`;
// //const { argv } = require('process');
// //const { hideBin } = require('yargs/helpers')
// const argv = yargs(process.argv)
// .scriptName("gis-csm")
// .usage(appStartMessage)
// // .command('serve [port]', 'start the server', (yargs) => {
// // yargs
// // .positional('f', {
// // describe: 'port to bind on',
// // type:'string',
// // default: 5000
// // })
// // }, (argv) => {
// // if (argv.verbose) console.info(`start server on :${argv.port}`)
// // //serve(argv.port)
// // console.log("test");
// // console.info(`start server on :${argv.port}`)
// // })
// .option('file', {
// alias: 'f',
// type: 'string',
// description: 'Specify the file out'
// })
// .option('directory', {
// alias: 'd',
// type: 'boolean',
// default:false,
// description: 'Name the output using current Basedirname'
// }).usage(`gis-csm -d --label # Assuming this file in directory: vm_s01-v01_768x___285k.jpg
// # will extract 285 and add that instead of filename`)
// .option('verbose', {
// alias: 'v',
// default:false,
// type: 'boolean',
// description: 'Run with verbose logging'
// })
// .option('label', {
// alias: 'l',
// type: 'boolean',
// default:false,
// description: 'Label using last digit in filename (used for parsing inference result that contain checkpoint number)'
// })
// .argv;
//-----------
var config = null;

@@ -42,18 +102,21 @@

var envErr = 0;
//----grab-the-env
if (process.env.asthostname)
config.hostname = process.env.asthostname;
config.hostname = process.env.asthostname;
else envErr++;
if (process.env.astoutsuffix)
config.outsuffix = process.env.astoutsuffix;
config.outsuffix = process.env.astoutsuffix;
else envErr++;
if ( process.env.astportbase)
config.portbase = process.env.astportbase;
config.portbase = process.env.astportbase;
else envErr++;
if (process.env.astcallprotocol)
config.callprotocol = process.env.astcallprotocol;
config.callprotocol = process.env.astcallprotocol;
else envErr++;
if (process.env.astcallmethod)
config.callmethod = process.env.astcallmethod;
config.callmethod = process.env.astcallmethod;
else envErr++;
if (envErr > 0) {

@@ -63,2 +126,4 @@ console.log("Env require setup");

}
//----grab-the-env

@@ -78,3 +143,3 @@ } catch (error) {

by Guillaume D-Isabelle, 2021
Version 0.1.14
Version 0.1.15
--------------------------------------

@@ -105,2 +170,10 @@ -------------HELP----------------------

var resizeSwitch = false;
var targetResolutionX = 768;
if (args[2]) {
resizeSwitch = true;
targetResolutionX = Number(args[2]);
}
//ModelID is related to a port will use

@@ -118,6 +191,48 @@ var modelid = args[1];

/*
//Use later to resized the image if switch used
sharp('input.jpg')
.rotate()
.resize(200)
.jpeg({ mozjpeg: true })
.toBuffer()
.then( data => { ... })
.catch( err => { ... });
*/
doWeResize(imgFile,config,portnum,callurl,targetOutput,resizeSwitch,targetResolutionX);
}
function doWeResize(imgFile,config,portnum,callurl,targetOutput,resizeSwitch=false,targetResolutionX=512)
{
if (resizeSwitch)
{
var tfile = tempfile('.jpg');
//console.log("Tempfile:" + tfile);
sharp(imgFile)
.resize(targetResolutionX)
.toFile( tfile, (err, info) => {
if (err) console.error(err);
//console.log(info);
console.log("A resized contentImage should be available at that path :\n feh " + tfile
+ " \n with resolution : " + targetResolutionX);
// process.exit(1);
doTheWork(tfile,config,portnum,callurl,targetOutput);
});
} else //no resize command
doTheWork(imgFile,config,portnum,callurl,targetOutput);
}
function doTheWork(cFile,config,portnum,callurl,targetOutput)
{
try {
var data = giaenc.
encFileToJSONStringifyBase64Prop(imgFile,"contentImage");
encFileToJSONStringifyBase64Prop(cFile,"contentImage");
//console.log(data);

@@ -139,3 +254,3 @@ //var unparsedData = JSON.parse(data);

console.log("Calling : " + config.hostname);
console.log("Calling : " + config.hostname + ":" + portnum);

@@ -152,2 +267,4 @@ axios.post(callurl, data, options)

giaenc.dec64_StringToFile(stylizedImage,targetOutput);
console.log("A stylizedImage should be available at that path :\n feh " + targetOutput);

@@ -168,9 +285,2 @@ //console.log(stylizedImage);

console.log(error);
}
}
}}

7

package.json
{
"name": "gia-ast",
"version": "0.1.14",
"version": "0.1.15",
"description": "A CLI Wrapping AST Web API calls to servers",

@@ -33,4 +33,7 @@ "main": "index.js",

"gia-lib-encoding-base64": "^0.1.0",
"safer-buffer": "^2.1.2"
"safer-buffer": "^2.1.2",
"sharp": "^0.28.1",
"tempfile": "^3.0.0",
"yargs": "^16.2.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc